Compare commits
11 Commits
890b05d352
...
23e0c5a9c8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
23e0c5a9c8 | ||
|
|
b907606818 | ||
|
|
05ab00e134 | ||
|
|
8617646685 | ||
|
|
ae6a2fafa3 | ||
|
|
740f440400 | ||
|
|
c335d7b082 | ||
|
|
2d20a13d7d | ||
|
|
4fc20b6d4f | ||
|
|
bba4b6028e | ||
|
|
40d468b433 |
12
README.org
12
README.org
@@ -1,6 +1,6 @@
|
||||
* Installing
|
||||
** Fresh system (nixos USB drive)
|
||||
1. Open a nix-shell with git:
|
||||
1. Open a nix-shell with git (if not installed):
|
||||
#+BEGIN_SRC bash
|
||||
nix-shell -p git
|
||||
#+END_SRC
|
||||
@@ -65,10 +65,18 @@
|
||||
#+END_SRC
|
||||
7. Install nixos!
|
||||
#+BEGIN_SRC bash
|
||||
sudo nixos-install --impure --root /mnt --flake .#reykjavik
|
||||
sudo nixos-install --impure --root /mnt --flake '.#reykjavik'
|
||||
#+END_SRC
|
||||
8. Set up the user
|
||||
You'll set the root password during the installation. You can then reboot and use the installed OS. First thing you'll have to do is log in as root and set the password for your user:
|
||||
#+BEGIN_SRC bash
|
||||
passwd marc
|
||||
#+END_SRC
|
||||
* Rebuilding
|
||||
#+BEGIN_SRC bash
|
||||
sudo nixos-rebuild switch --impure --flake '.#reykjavik'
|
||||
#+END_SRC
|
||||
* Modules
|
||||
** Desktop environment
|
||||
*** Themeing
|
||||
We use [[https://github.com/Misterio77/nix-colors][nix-colors]] to (try to) keep a consistent theme across all applications. This uses [[https://github.com/chriskempson/base16][base-16 themes]] (here is a [[https://github.com/chriskempson/base16/blob/main/styling.md][styiling guide]] for it).
|
||||
|
||||
@@ -5,3 +5,5 @@ font:
|
||||
normal:
|
||||
family: Iosevka Nerd Font
|
||||
style: Regular
|
||||
import:
|
||||
- ~/.config/alacritty/theme.yml
|
||||
|
||||
@@ -12,20 +12,18 @@ font-0 = "Iosevka:size=10;2"
|
||||
font-1 = "Iosevka:size=16;2"
|
||||
font-2 = "Iosevka:size=22;4"
|
||||
|
||||
background = ${colours.trans}
|
||||
foreground = ${colours.white}
|
||||
background = ${colours/bar.bg}
|
||||
foreground = ${colours/bar.fg}
|
||||
|
||||
border-bottom-size = 5
|
||||
border-top-size = 5
|
||||
|
||||
border-left-size = 10
|
||||
border-right-size = 10
|
||||
|
||||
border-bottom-colour = ${colours.trans}
|
||||
border-top-colour = ${colours.trans}
|
||||
|
||||
border-left-colour = ${colours.trans}
|
||||
border-right-colour = ${colours.trans}
|
||||
border-bottom-color = ${colours/bar.bg}
|
||||
border-top-color = ${colours/bar.bg}
|
||||
border-left-color = ${colours/bar.bg}
|
||||
border-right-color = ${colours/bar.bg}
|
||||
|
||||
spacing = 0
|
||||
padding-left = 0
|
||||
@@ -34,8 +32,8 @@ module-margin-left = 0
|
||||
|
||||
separator = |
|
||||
separator-padding = .5
|
||||
separator-foreground = ${colours.trans}
|
||||
separator-background = ${colours.trans}
|
||||
separator-foreground = ${colours/bar.bg}
|
||||
separator-background = ${colours/bar.bg}
|
||||
|
||||
[bar/bottom]
|
||||
inherit = bar/base
|
||||
|
||||
@@ -4,80 +4,54 @@ white = #fff
|
||||
black = #000
|
||||
gray = #555
|
||||
|
||||
blue- = #498AD4
|
||||
blue = #2B6CB6
|
||||
blue+ = #173B63
|
||||
|
||||
xanadu- = #B3BCB6
|
||||
xanadu = #808F85
|
||||
xanadu+ = #606C64
|
||||
|
||||
green- = #CAE2CE
|
||||
green = #91C499
|
||||
green+ = #61A86D
|
||||
|
||||
linen- = #F9F5F0
|
||||
linen = #F2E9DC
|
||||
linen+ = #DEC6A6
|
||||
|
||||
pear- = #E8EB5C
|
||||
pear = #CFD11A
|
||||
pear+ = #8F9112
|
||||
|
||||
orange- = #FEB548
|
||||
orange = #F18F01
|
||||
orange+ = #A26201
|
||||
|
||||
apricot = #FFCAB1
|
||||
|
||||
rose- = #CC8FA0
|
||||
rose = #AB4E68
|
||||
rose+ = #7E3A4D
|
||||
[colours/bar]
|
||||
bg = ${colours.trans}
|
||||
fg = ${colour-scheme.base05}
|
||||
|
||||
[colours/date]
|
||||
bg = ${colours.pear}
|
||||
fg = ${colours.gray}
|
||||
bg = ${colour-scheme.base01}
|
||||
fg = ${colour-scheme.base05}
|
||||
|
||||
[colours/battery]
|
||||
full-bg = ${colours.green+}
|
||||
full-fg = ${colours.gray}
|
||||
charging-bg = ${colours.green}
|
||||
charging-fg = ${colours.gray}
|
||||
discharging-bg = ${colours.green}
|
||||
discharging-fg = ${colours.gray}
|
||||
low-bg = ${colours.orange}
|
||||
low-fg = ${colours.gray}
|
||||
full-bg = ${colour-scheme.base0C}
|
||||
full-fg = ${colour-scheme.base01}
|
||||
charging-bg = ${colour-scheme.base0C}
|
||||
charging-fg = ${colour-scheme.base01}
|
||||
discharging-bg = ${colour-scheme.base01}
|
||||
discharging-fg = ${colour-scheme.base05}
|
||||
low-bg = ${colour-scheme.base0E}
|
||||
low-fg = ${colour-scheme.base01}
|
||||
|
||||
[colours/workspaces]
|
||||
focused-bg = ${colours.linen+}
|
||||
focused-fg = ${colours.gray}
|
||||
unfocused-bg = ${colours.linen}
|
||||
unfocused-fg = ${colours.gray}
|
||||
urgent-bg = ${colours.orange-}
|
||||
urgent-fg = ${colours.gray}
|
||||
focused-bg = ${colour-scheme.base02}
|
||||
focused-fg = ${colour-scheme.base04}
|
||||
unfocused-bg = ${colour-scheme.base01}
|
||||
unfocused-fg = ${colour-scheme.base05}
|
||||
urgent-bg = ${colour-scheme.base0E}
|
||||
urgent-fg = ${colour-scheme.base01}
|
||||
|
||||
[colours/i3-mode]
|
||||
bg = ${colours.orange}
|
||||
fg = ${colours.gray}
|
||||
bg = ${colour-scheme.base0E}
|
||||
fg = ${colour-scheme.base01}
|
||||
|
||||
[colours/volume]
|
||||
volume-bg = ${colours.rose}
|
||||
volume-fg = ${colours.white}
|
||||
muted-bg = ${colours.rose-}
|
||||
muted-fg = ${colours.white}
|
||||
volume-bg = ${colour-scheme.base0C}
|
||||
volume-fg = ${colour-scheme.base01}
|
||||
muted-bg = ${colour-scheme.base01}
|
||||
muted-fg = ${colour-scheme.base05}
|
||||
|
||||
[colours/wireless]
|
||||
connected-bg = ${colours.apricot}
|
||||
connected-fg = ${colours.gray}
|
||||
disconnected-bg = ${colours.apricot}
|
||||
disconnected-fg = ${colours.gray}
|
||||
packetloss-bg = ${colours.apricot}
|
||||
packetloss-fg = ${colours.gray}
|
||||
connected-bg = ${colour-scheme.base0C}
|
||||
connected-fg = ${colour-scheme.base01}
|
||||
disconnected-bg = ${colour-scheme.base01}
|
||||
disconnected-fg = ${colour-scheme.base05}
|
||||
packetloss-bg = ${colour-scheme.base0E}
|
||||
packetloss-fg = ${colour-scheme.base01}
|
||||
|
||||
[colours/bluetooth]
|
||||
bg = ${colours.blue}
|
||||
fg = ${colours.white}
|
||||
bg = ${colour-scheme.base0C}
|
||||
fg = ${colour-scheme.base01}
|
||||
|
||||
[colours/spotify]
|
||||
bg = ${colours.green}
|
||||
fg = ${colours.gray}
|
||||
bg = ${colour-scheme.base0A}
|
||||
fg = ${colour-scheme.base01}
|
||||
|
||||
@@ -4,7 +4,7 @@ full-at = 100
|
||||
low-at = 20
|
||||
battery = BAT0
|
||||
adapter = ADP0
|
||||
poll-interval = 5
|
||||
poll-interval = 1
|
||||
|
||||
format-full = <label-full>
|
||||
label-full = "%{T2}%{T-} %percentage%%"
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
[module/bluetooth]
|
||||
type = custom/script
|
||||
exec = ~/.config/polybar/scripts/bluetooth.sh
|
||||
exec = ~/.config/rofi/menus/bluetooth/bluetooth.sh --status
|
||||
interval = 5
|
||||
click-left = ~/.config/polybar/scripts/bluetooth.sh --toggle &
|
||||
click-left = ~/.config/rofi/menus/bluetooth/bluetooth.sh
|
||||
|
||||
format-background = ${colours/bluetooth.bg}
|
||||
format-foreground = ${colours/bluetooth.fg}
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
# This file is generated by nixos-rebuild
|
||||
include-file = colour-scheme.ini
|
||||
include-file = bars/bars.ini
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
bluetooth_print() {
|
||||
if bluetoothctl show | grep -q "Powered: yes"; then
|
||||
printf ''
|
||||
|
||||
devices_paired=$(bluetoothctl paired-devices | grep Device | cut -d ' ' -f 2)
|
||||
counter=0
|
||||
|
||||
for device in $devices_paired; do
|
||||
device_info=$(bluetoothctl info "$device")
|
||||
|
||||
if echo "$device_info" | grep -q "Connected: yes"; then
|
||||
device_alias=$(echo "$device_info" | grep "Alias" | cut -d ' ' -f 2-)
|
||||
|
||||
if [ $counter -gt 0 ]; then
|
||||
printf ", %s" "$device_alias"
|
||||
else
|
||||
printf " %s" "$device_alias"
|
||||
fi
|
||||
|
||||
counter=$((counter + 1))
|
||||
fi
|
||||
done
|
||||
|
||||
printf '\n'
|
||||
else
|
||||
echo " -"
|
||||
fi
|
||||
}
|
||||
|
||||
bluetooth_toggle() {
|
||||
if bluetoothctl show | grep -q "Powered: no"; then
|
||||
bluetoothctl power on >> /dev/null
|
||||
sleep 1
|
||||
|
||||
devices_paired=$(bluetoothctl paired-devices | grep Device | cut -d ' ' -f 2)
|
||||
echo "$devices_paired" | while read -r line; do
|
||||
bluetoothctl connect "$line" >> /dev/null
|
||||
done
|
||||
else
|
||||
devices_paired=$(bluetoothctl devices Paired | grep Device | cut -d ' ' -f 2)
|
||||
echo "$devices_paired" | while read -r line; do
|
||||
bluetoothctl disconnect "$line" >> /dev/null
|
||||
done
|
||||
|
||||
bluetoothctl power off >> /dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
--toggle)
|
||||
bluetooth_toggle
|
||||
;;
|
||||
*)
|
||||
bluetooth_print
|
||||
;;
|
||||
esac
|
||||
139
config/.config/rofi/menus/bluetooth/bluetooth.rasi
Normal file
139
config/.config/rofi/menus/bluetooth/bluetooth.rasi
Normal file
@@ -0,0 +1,139 @@
|
||||
/**
|
||||
*
|
||||
* Author : Marc Sastre, based on Aditya Shakya (adi1090x, Github : @adi1090x)
|
||||
*
|
||||
**/
|
||||
|
||||
@import "../../theme.rasi"
|
||||
|
||||
/*****----- Configuration -----*****/
|
||||
configuration {
|
||||
show-icons: false;
|
||||
}
|
||||
|
||||
/*****----- Main Window -----*****/
|
||||
window {
|
||||
/* properties for window widget */
|
||||
transparency: "real";
|
||||
location: center;
|
||||
anchor: center;
|
||||
fullscreen: false;
|
||||
width: 800px;
|
||||
x-offset: 0px;
|
||||
y-offset: 0px;
|
||||
|
||||
/* properties for all widgets */
|
||||
enabled: true;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: 2px solid;
|
||||
border-radius: 15px;
|
||||
border-color: @background-alt;
|
||||
cursor: "default";
|
||||
background-color: @background;
|
||||
}
|
||||
|
||||
/*****----- Main Box -----*****/
|
||||
mainbox {
|
||||
enabled: true;
|
||||
spacing: 15px;
|
||||
margin: 0px;
|
||||
padding: 30px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px;
|
||||
border-color: @selected;
|
||||
background-color: transparent;
|
||||
children: [ "inputbar", "listview" ];
|
||||
}
|
||||
message {
|
||||
enabled: true;
|
||||
margin: 0px;
|
||||
padding: 10px;
|
||||
border: 0px solid;
|
||||
border-radius: 10px;
|
||||
border-color: @selected;
|
||||
background-color: @background-alt;
|
||||
text-color: @foreground;
|
||||
}
|
||||
textbox {
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
vertical-align: 0.5;
|
||||
horizontal-align: 0.0;
|
||||
placeholder-color: @foreground;
|
||||
blink: true;
|
||||
markup: true;
|
||||
}
|
||||
|
||||
/*****----- Inputbar -----*****/
|
||||
inputbar {
|
||||
enabled: true;
|
||||
spacing: 10px;
|
||||
padding: 15px;
|
||||
border-radius: 10px;
|
||||
background-color: @background-alt;
|
||||
text-color: @foreground;
|
||||
children: [ "textbox-prompt-colon", "entry" ];
|
||||
}
|
||||
textbox-prompt-colon {
|
||||
enabled: true;
|
||||
expand: false;
|
||||
str: "";
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
entry {
|
||||
enabled: true;
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
cursor: text;
|
||||
}
|
||||
|
||||
/*****----- Listview -----*****/
|
||||
listview {
|
||||
enabled: true;
|
||||
columns: 1;
|
||||
lines: 5;
|
||||
cycle: true;
|
||||
dynamic: true;
|
||||
scrollbar: false;
|
||||
layout: vertical;
|
||||
reverse: false;
|
||||
fixed-height: true;
|
||||
fixed-columns: true;
|
||||
|
||||
spacing: 5px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px;
|
||||
border-color: @selected;
|
||||
background-color: transparent;
|
||||
text-color: @foreground;
|
||||
cursor: "default";
|
||||
}
|
||||
|
||||
/*****----- Elements -----*****/
|
||||
element {
|
||||
enabled: true;
|
||||
spacing: 0px;
|
||||
margin: 0px;
|
||||
padding: 12px;
|
||||
border: 0px solid;
|
||||
border-radius: 100%;
|
||||
border-color: @selected;
|
||||
background-color: transparent;
|
||||
text-color: @foreground;
|
||||
cursor: pointer;
|
||||
}
|
||||
element-text {
|
||||
background-color: transparent;
|
||||
text-color: inherit;
|
||||
cursor: inherit;
|
||||
vertical-align: 0.5;
|
||||
horizontal-align: 0.0;
|
||||
}
|
||||
element selected.normal {
|
||||
background-color: var(selected);
|
||||
text-color: var(background);
|
||||
}
|
||||
322
config/.config/rofi/menus/bluetooth/bluetooth.sh
Executable file
322
config/.config/rofi/menus/bluetooth/bluetooth.sh
Executable file
@@ -0,0 +1,322 @@
|
||||
#!/usr/bin/env bash
|
||||
# __ _ _ _ _ _ _
|
||||
# _ __ ___ / _(_) | |__ | |_ _ ___| |_ ___ ___ | |_| |__
|
||||
# | '__/ _ \| |_| |_____| '_ \| | | | |/ _ \ __/ _ \ / _ \| __| '_ \
|
||||
# | | | (_) | _| |_____| |_) | | |_| | __/ || (_) | (_) | |_| | | |
|
||||
# |_| \___/|_| |_| |_.__/|_|\__,_|\___|\__\___/ \___/ \__|_| |_|
|
||||
#
|
||||
# Author: Nick Clyde (clydedroid)
|
||||
#
|
||||
# A script that generates a rofi menu that uses bluetoothctl to
|
||||
# connect to bluetooth devices and display status info.
|
||||
#
|
||||
# Inspired by networkmanager-dmenu (https://github.com/firecat53/networkmanager-dmenu)
|
||||
# Thanks to x70b1 (https://github.com/polybar/polybar-scripts/tree/master/polybar-scripts/system-bluetooth-bluetoothctl)
|
||||
#
|
||||
# Depends on:
|
||||
# Arch repositories: rofi, bluez-utils (contains bluetoothctl)
|
||||
|
||||
# Constants
|
||||
divider=""
|
||||
goback="Back"
|
||||
|
||||
# For debugging/development purposes
|
||||
# PREFIX=projects/samfelag/config/
|
||||
|
||||
# Rofi command to pipe into, can add any options here
|
||||
dir="$HOME/$PREFIX.config/rofi/menus/bluetooth/"
|
||||
theme='bluetooth'
|
||||
|
||||
rofi_command="rofi -dmenu -theme ${dir}/${theme}.rasi -i -p"
|
||||
|
||||
# rofi -dmenu \
|
||||
# -theme ${dir}/${theme}.rasi
|
||||
|
||||
# Checks if bluetooth controller is powered on
|
||||
power_on() {
|
||||
if bluetoothctl show | grep -q "Powered: yes"; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Toggles power state
|
||||
toggle_power() {
|
||||
if power_on; then
|
||||
bluetoothctl power off
|
||||
show_menu
|
||||
else
|
||||
if rfkill list bluetooth | grep -q 'blocked: yes'; then
|
||||
rfkill unblock bluetooth && sleep 3
|
||||
fi
|
||||
bluetoothctl power on
|
||||
show_menu
|
||||
fi
|
||||
}
|
||||
|
||||
# Checks if controller is scanning for new devices
|
||||
scan_on() {
|
||||
if bluetoothctl show | grep -q "Discovering: yes"; then
|
||||
echo "Scan: on"
|
||||
return 0
|
||||
else
|
||||
echo "Scan: off"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Toggles scanning state
|
||||
toggle_scan() {
|
||||
if scan_on; then
|
||||
kill $(pgrep -f "bluetoothctl scan on")
|
||||
bluetoothctl scan off
|
||||
show_menu
|
||||
else
|
||||
bluetoothctl scan on &
|
||||
echo "Scanning..."
|
||||
sleep 5
|
||||
show_menu
|
||||
fi
|
||||
}
|
||||
|
||||
# Checks if controller is able to pair to devices
|
||||
pairable_on() {
|
||||
if bluetoothctl show | grep -q "Pairable: yes"; then
|
||||
echo "Pairable: on"
|
||||
return 0
|
||||
else
|
||||
echo "Pairable: off"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Toggles pairable state
|
||||
toggle_pairable() {
|
||||
if pairable_on; then
|
||||
bluetoothctl pairable off
|
||||
show_menu
|
||||
else
|
||||
bluetoothctl pairable on
|
||||
show_menu
|
||||
fi
|
||||
}
|
||||
|
||||
# Checks if controller is discoverable by other devices
|
||||
discoverable_on() {
|
||||
if bluetoothctl show | grep -q "Discoverable: yes"; then
|
||||
echo "Discoverable: on"
|
||||
return 0
|
||||
else
|
||||
echo "Discoverable: off"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Toggles discoverable state
|
||||
toggle_discoverable() {
|
||||
if discoverable_on; then
|
||||
bluetoothctl discoverable off
|
||||
show_menu
|
||||
else
|
||||
bluetoothctl discoverable on
|
||||
show_menu
|
||||
fi
|
||||
}
|
||||
|
||||
# Checks if a device is connected
|
||||
device_connected() {
|
||||
device_info=$(bluetoothctl info "$1")
|
||||
if echo "$device_info" | grep -q "Connected: yes"; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Toggles device connection
|
||||
toggle_connection() {
|
||||
if device_connected $1; then
|
||||
bluetoothctl disconnect $1
|
||||
device_menu "$device"
|
||||
else
|
||||
bluetoothctl connect $1
|
||||
device_menu "$device"
|
||||
fi
|
||||
}
|
||||
|
||||
# Checks if a device is paired
|
||||
device_paired() {
|
||||
device_info=$(bluetoothctl info "$1")
|
||||
if echo "$device_info" | grep -q "Paired: yes"; then
|
||||
echo "Paired: yes"
|
||||
return 0
|
||||
else
|
||||
echo "Paired: no"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Toggles device paired state
|
||||
toggle_paired() {
|
||||
if device_paired $1; then
|
||||
bluetoothctl remove $1
|
||||
device_menu "$device"
|
||||
else
|
||||
bluetoothctl pair $1
|
||||
device_menu "$device"
|
||||
fi
|
||||
}
|
||||
|
||||
# Checks if a device is trusted
|
||||
device_trusted() {
|
||||
device_info=$(bluetoothctl info "$1")
|
||||
if echo "$device_info" | grep -q "Trusted: yes"; then
|
||||
echo "Trusted: yes"
|
||||
return 0
|
||||
else
|
||||
echo "Trusted: no"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Toggles device connection
|
||||
toggle_trust() {
|
||||
if device_trusted $1; then
|
||||
bluetoothctl untrust $1
|
||||
device_menu "$device"
|
||||
else
|
||||
bluetoothctl trust $1
|
||||
device_menu "$device"
|
||||
fi
|
||||
}
|
||||
|
||||
# Prints a short string with the current bluetooth status
|
||||
# Useful for status bars like polybar, etc.
|
||||
print_status() {
|
||||
if power_on; then
|
||||
printf ''
|
||||
|
||||
paired_devices_cmd="paired-devices"
|
||||
|
||||
mapfile -t paired_devices < <(bluetoothctl $paired_devices_cmd | grep Device | cut -d ' ' -f 2)
|
||||
counter=0
|
||||
|
||||
for device in "${paired_devices[@]}"; do
|
||||
if device_connected $device; then
|
||||
device_alias=$(bluetoothctl info $device | grep "Alias" | cut -d ' ' -f 2-)
|
||||
|
||||
if [ $counter -gt 0 ]; then
|
||||
printf ", %s" "$device_alias"
|
||||
else
|
||||
printf " %s" "$device_alias"
|
||||
fi
|
||||
|
||||
((counter++))
|
||||
fi
|
||||
done
|
||||
printf "\n"
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
# A submenu for a specific device that allows connecting, pairing, and trusting
|
||||
device_menu() {
|
||||
device=$1
|
||||
|
||||
# Get device name and mac address
|
||||
device_name=$(echo $device | cut -d ' ' -f 3-)
|
||||
mac=$(echo $device | cut -d ' ' -f 2)
|
||||
|
||||
# Build options
|
||||
if device_connected $mac; then
|
||||
connected="Connected: yes"
|
||||
else
|
||||
connected="Connected: no"
|
||||
fi
|
||||
paired=$(device_paired $mac)
|
||||
trusted=$(device_trusted $mac)
|
||||
options="$connected\n$paired\n$trusted\n$divider\n$goback\nExit"
|
||||
|
||||
# Open rofi menu, read chosen option
|
||||
chosen="$(echo -e "$options" | $rofi_command "$device_name")"
|
||||
|
||||
# Match chosen option to command
|
||||
case $chosen in
|
||||
"" | $divider)
|
||||
echo "No option chosen."
|
||||
;;
|
||||
$connected)
|
||||
toggle_connection $mac
|
||||
;;
|
||||
$paired)
|
||||
toggle_paired $mac
|
||||
;;
|
||||
$trusted)
|
||||
toggle_trust $mac
|
||||
;;
|
||||
$goback)
|
||||
show_menu
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Opens a rofi menu with current bluetooth status and options to connect
|
||||
show_menu() {
|
||||
# Get menu options
|
||||
if power_on; then
|
||||
power="Power: on"
|
||||
|
||||
# Human-readable names of devices, one per line
|
||||
# If scan is off, will only list paired devices
|
||||
devices=$(bluetoothctl devices | grep Device | cut -d ' ' -f 3-)
|
||||
|
||||
# Get controller flags
|
||||
scan=$(scan_on)
|
||||
pairable=$(pairable_on)
|
||||
discoverable=$(discoverable_on)
|
||||
|
||||
# Options passed to rofi
|
||||
options="$devices\n$divider\n$power\n$scan\n$pairable\n$discoverable\nExit"
|
||||
else
|
||||
power="Power: off"
|
||||
options="$power\nExit"
|
||||
fi
|
||||
|
||||
# Open rofi menu, read chosen option
|
||||
chosen="$(echo -e "$options" | $rofi_command "Bluetooth")"
|
||||
|
||||
# Match chosen option to command
|
||||
case $chosen in
|
||||
"" | $divider)
|
||||
echo "No option chosen."
|
||||
;;
|
||||
$power)
|
||||
toggle_power
|
||||
;;
|
||||
$scan)
|
||||
toggle_scan
|
||||
;;
|
||||
$discoverable)
|
||||
toggle_discoverable
|
||||
;;
|
||||
$pairable)
|
||||
toggle_pairable
|
||||
;;
|
||||
*)
|
||||
device=$(bluetoothctl devices | grep "$chosen")
|
||||
# Open a submenu if a device is selected
|
||||
if [[ $device ]]; then device_menu "$device"; fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
--status)
|
||||
print_status
|
||||
;;
|
||||
*)
|
||||
show_menu
|
||||
;;
|
||||
esac
|
||||
BIN
config/.config/rofi/menus/launcher/flor01.png
Normal file
BIN
config/.config/rofi/menus/launcher/flor01.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 77 KiB |
199
config/.config/rofi/menus/launcher/launcher.rasi
Normal file
199
config/.config/rofi/menus/launcher/launcher.rasi
Normal file
@@ -0,0 +1,199 @@
|
||||
/**
|
||||
*
|
||||
* Author : Marc Sastre, based on Aditya Shakya (adi1090x, Github : @adi1090x)
|
||||
*
|
||||
**/
|
||||
|
||||
@import "../../theme.rasi"
|
||||
|
||||
/*****----- Configuration -----*****/
|
||||
configuration {
|
||||
modi: "drun,run,filebrowser,window";
|
||||
show-icons: true;
|
||||
display-drun: "APPS";
|
||||
display-run: "RUN";
|
||||
display-filebrowser: "FILES";
|
||||
display-window: "WINDOW";
|
||||
drun-display-format: "{name}";
|
||||
window-format: "{w} · {c} · {t}";
|
||||
}
|
||||
|
||||
/*****----- Main Window -----*****/
|
||||
window {
|
||||
/* properties for window widget */
|
||||
transparency: "real";
|
||||
location: center;
|
||||
anchor: center;
|
||||
fullscreen: false;
|
||||
width: 1000px;
|
||||
x-offset: 0px;
|
||||
y-offset: 0px;
|
||||
|
||||
/* properties for all widgets */
|
||||
enabled: true;
|
||||
border: 2px solid;
|
||||
border-radius: 15px;
|
||||
border-color: @background-alt;
|
||||
cursor: "default";
|
||||
background-color: @background;
|
||||
}
|
||||
|
||||
/*****----- Main Box -----*****/
|
||||
mainbox {
|
||||
enabled: true;
|
||||
spacing: 0px;
|
||||
background-color: transparent;
|
||||
orientation: horizontal;
|
||||
children: [ "imagebox", "listbox" ];
|
||||
}
|
||||
|
||||
imagebox {
|
||||
padding: 20px;
|
||||
background-color: transparent;
|
||||
background-image: url("~/.config/rofi/menus/launcher/flor01.png", width);
|
||||
orientation: vertical;
|
||||
children: [ "inputbar", "dummy", "mode-switcher" ];
|
||||
}
|
||||
|
||||
listbox {
|
||||
spacing: 20px;
|
||||
padding: 20px;
|
||||
background-color: transparent;
|
||||
orientation: vertical;
|
||||
children: [ "message", "listview" ];
|
||||
}
|
||||
|
||||
dummy {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
/*****----- Inputbar -----*****/
|
||||
inputbar {
|
||||
enabled: true;
|
||||
spacing: 10px;
|
||||
padding: 15px;
|
||||
border-radius: 10px;
|
||||
background-color: @background-alt;
|
||||
text-color: @foreground;
|
||||
children: [ "textbox-prompt-colon", "entry" ];
|
||||
}
|
||||
textbox-prompt-colon {
|
||||
enabled: true;
|
||||
expand: false;
|
||||
str: "";
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
entry {
|
||||
enabled: true;
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
cursor: text;
|
||||
placeholder: "Search";
|
||||
placeholder-color: inherit;
|
||||
}
|
||||
|
||||
/*****----- Mode Switcher -----*****/
|
||||
mode-switcher{
|
||||
enabled: true;
|
||||
spacing: 20px;
|
||||
background-color: transparent;
|
||||
text-color: @foreground;
|
||||
}
|
||||
button {
|
||||
padding: 15px;
|
||||
border-radius: 10px;
|
||||
background-color: @background-alt;
|
||||
text-color: inherit;
|
||||
cursor: pointer;
|
||||
}
|
||||
button selected {
|
||||
background-color: @selected;
|
||||
text-color: @foreground;
|
||||
}
|
||||
|
||||
/*****----- Listview -----*****/
|
||||
listview {
|
||||
enabled: true;
|
||||
columns: 1;
|
||||
lines: 8;
|
||||
cycle: true;
|
||||
dynamic: true;
|
||||
scrollbar: false;
|
||||
layout: vertical;
|
||||
reverse: false;
|
||||
fixed-height: true;
|
||||
fixed-columns: true;
|
||||
|
||||
spacing: 10px;
|
||||
background-color: transparent;
|
||||
text-color: @foreground;
|
||||
cursor: "default";
|
||||
}
|
||||
|
||||
/*****----- Elements -----*****/
|
||||
element {
|
||||
enabled: true;
|
||||
spacing: 15px;
|
||||
padding: 8px;
|
||||
border-radius: 10px;
|
||||
background-color: transparent;
|
||||
text-color: @foreground;
|
||||
cursor: pointer;
|
||||
}
|
||||
element normal.normal {
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
element normal.urgent {
|
||||
background-color: @urgent;
|
||||
text-color: @foreground;
|
||||
}
|
||||
element normal.active {
|
||||
background-color: @active;
|
||||
text-color: @foreground;
|
||||
}
|
||||
element selected.normal {
|
||||
background-color: @selected;
|
||||
text-color: @foreground;
|
||||
}
|
||||
element selected.urgent {
|
||||
background-color: @urgent;
|
||||
text-color: @foreground;
|
||||
}
|
||||
element selected.active {
|
||||
background-color: @urgent;
|
||||
text-color: @foreground;
|
||||
}
|
||||
element-icon {
|
||||
background-color: transparent;
|
||||
text-color: inherit;
|
||||
size: 32px;
|
||||
cursor: inherit;
|
||||
}
|
||||
element-text {
|
||||
background-color: transparent;
|
||||
text-color: inherit;
|
||||
cursor: inherit;
|
||||
vertical-align: 0.5;
|
||||
horizontal-align: 0.0;
|
||||
}
|
||||
|
||||
/*****----- Message -----*****/
|
||||
message {
|
||||
background-color: transparent;
|
||||
}
|
||||
textbox {
|
||||
padding: 15px;
|
||||
border-radius: 10px;
|
||||
background-color: @background-alt;
|
||||
text-color: @foreground;
|
||||
vertical-align: 0.5;
|
||||
horizontal-align: 0.0;
|
||||
}
|
||||
error-message {
|
||||
padding: 15px;
|
||||
border-radius: 20px;
|
||||
background-color: @background;
|
||||
text-color: @foreground;
|
||||
}
|
||||
13
config/.config/rofi/menus/launcher/launcher.sh
Executable file
13
config/.config/rofi/menus/launcher/launcher.sh
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
## Author : Marc Sastre, based on Aditya Shakya (adi1090x, Github : @adi1090x)
|
||||
## Rofi : Launcher
|
||||
|
||||
# For debugging/development purposes
|
||||
# PREFIX=projects/samfelag/config/
|
||||
|
||||
# Rofi command to pipe into, can add any options here
|
||||
dir="$HOME/$PREFIX.config/rofi/menus/launcher/"
|
||||
theme='launcher'
|
||||
|
||||
rofi -show drun -theme ${dir}/${theme}.rasi
|
||||
115
config/.config/rofi/menus/powermenu/powermenu.rasi
Normal file
115
config/.config/rofi/menus/powermenu/powermenu.rasi
Normal file
@@ -0,0 +1,115 @@
|
||||
/**
|
||||
*
|
||||
* Author : Marc Sastre, based on Aditya Shakya (adi1090x, Github : @adi1090x)
|
||||
*
|
||||
**/
|
||||
|
||||
@import "../../theme.rasi"
|
||||
|
||||
/*****----- Configuration -----*****/
|
||||
configuration {
|
||||
show-icons: false;
|
||||
}
|
||||
|
||||
/*****----- Main Window -----*****/
|
||||
window {
|
||||
/* properties for window widget */
|
||||
transparency: "real";
|
||||
location: center;
|
||||
anchor: center;
|
||||
fullscreen: false;
|
||||
width: 500px;
|
||||
x-offset: 0px;
|
||||
y-offset: 0px;
|
||||
|
||||
/* properties for all widgets */
|
||||
enabled: true;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: 2px solid;
|
||||
border-radius: 15px;
|
||||
border-color: @background-alt;
|
||||
cursor: "default";
|
||||
background-color: @background;
|
||||
}
|
||||
|
||||
/*****----- Main Box -----*****/
|
||||
mainbox {
|
||||
enabled: true;
|
||||
spacing: 15px;
|
||||
margin: 0px;
|
||||
padding: 30px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px;
|
||||
border-color: @selected;
|
||||
background-color: transparent;
|
||||
children: [ "listview" ];
|
||||
}
|
||||
message {
|
||||
enabled: true;
|
||||
margin: 0px;
|
||||
padding: 10px;
|
||||
border: 0px solid;
|
||||
border-radius: 10px;
|
||||
border-color: @selected;
|
||||
background-color: @background-alt;
|
||||
text-color: @foreground;
|
||||
}
|
||||
textbox {
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
vertical-align: 0.5;
|
||||
horizontal-align: 0.0;
|
||||
placeholder-color: @foreground;
|
||||
blink: true;
|
||||
markup: true;
|
||||
}
|
||||
|
||||
/*****----- Listview -----*****/
|
||||
listview {
|
||||
enabled: true;
|
||||
columns: 1;
|
||||
lines: 5;
|
||||
cycle: true;
|
||||
dynamic: true;
|
||||
scrollbar: false;
|
||||
layout: vertical;
|
||||
reverse: false;
|
||||
fixed-height: true;
|
||||
fixed-columns: true;
|
||||
|
||||
spacing: 5px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px;
|
||||
border-color: @selected;
|
||||
background-color: transparent;
|
||||
text-color: @foreground;
|
||||
cursor: "default";
|
||||
}
|
||||
|
||||
/*****----- Elements -----*****/
|
||||
element {
|
||||
enabled: true;
|
||||
spacing: 0px;
|
||||
margin: 0px;
|
||||
padding: 12px;
|
||||
border: 0px solid;
|
||||
border-radius: 100%;
|
||||
border-color: @selected;
|
||||
background-color: transparent;
|
||||
text-color: @foreground;
|
||||
cursor: pointer;
|
||||
}
|
||||
element-text {
|
||||
background-color: transparent;
|
||||
text-color: inherit;
|
||||
cursor: inherit;
|
||||
vertical-align: 0.5;
|
||||
horizontal-align: 0.0;
|
||||
}
|
||||
element selected.normal {
|
||||
background-color: var(selected);
|
||||
text-color: var(background);
|
||||
}
|
||||
98
config/.config/rofi/menus/powermenu/powermenu.sh
Executable file
98
config/.config/rofi/menus/powermenu/powermenu.sh
Executable file
@@ -0,0 +1,98 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
## Author : Marc Sastre, based on Aditya Shakya (adi1090x, Github : @adi1090x)
|
||||
## Rofi : Power Menu
|
||||
|
||||
# Current Theme
|
||||
dir="$HOME/.config/rofi/menus/powermenu/"
|
||||
theme='powermenu'
|
||||
|
||||
# CMDs
|
||||
|
||||
# Options
|
||||
shutdown='襤 Shutdown'
|
||||
reboot=' Reboot'
|
||||
lock=' Lock'
|
||||
suspend=' Suspend'
|
||||
logout=' Logout'
|
||||
yes='Yes'
|
||||
no='No'
|
||||
|
||||
# Rofi CMD
|
||||
rofi_cmd() {
|
||||
rofi -dmenu \
|
||||
-theme ${dir}/${theme}.rasi
|
||||
}
|
||||
|
||||
# Confirmation CMD
|
||||
confirm_cmd() {
|
||||
rofi -theme-str 'window {location: center; anchor: center; fullscreen: false; width: 250px;}' \
|
||||
-theme-str 'mainbox {children: [ "message", "listview" ];}' \
|
||||
-theme-str 'listview {columns: 2; lines: 1;}' \
|
||||
-theme-str 'element-text {horizontal-align: 0.5;}' \
|
||||
-theme-str 'textbox {horizontal-align: 0.5;}' \
|
||||
-dmenu \
|
||||
-p 'Confirmation' \
|
||||
-mesg 'Are you Sure?' \
|
||||
-theme ${dir}/${theme}.rasi
|
||||
}
|
||||
|
||||
# Ask for confirmation
|
||||
confirm_exit() {
|
||||
echo -e "$yes\n$no" | confirm_cmd
|
||||
}
|
||||
|
||||
# Pass variables to rofi dmenu
|
||||
run_rofi() {
|
||||
echo -e "$lock\n$suspend\n$logout\n$reboot\n$shutdown" | rofi_cmd
|
||||
}
|
||||
|
||||
# Execute Command
|
||||
run_cmd() {
|
||||
selected="$(confirm_exit)"
|
||||
if [[ "$selected" == "$yes" ]]; then
|
||||
if [[ $1 == '--shutdown' ]]; then
|
||||
systemctl poweroff -i
|
||||
elif [[ $1 == '--reboot' ]]; then
|
||||
systemctl reboot
|
||||
elif [[ $1 == '--suspend' ]]; then
|
||||
systemctl suspend
|
||||
elif [[ $1 == '--logout' ]]; then
|
||||
if [[ "$DESKTOP_SESSION" == 'openbox' ]]; then
|
||||
openbox --exit
|
||||
elif [[ "$DESKTOP_SESSION" == 'bspwm' ]]; then
|
||||
bspc quit
|
||||
elif [[ "$DESKTOP_SESSION" == 'i3' ]]; then
|
||||
i3-msg exit
|
||||
elif [[ "$DESKTOP_SESSION" == 'plasma' ]]; then
|
||||
qdbus org.kde.ksmserver /KSMServer logout 0 0 0
|
||||
fi
|
||||
fi
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
# Actions
|
||||
chosen="$(run_rofi)"
|
||||
case ${chosen} in
|
||||
$shutdown)
|
||||
run_cmd --shutdown
|
||||
;;
|
||||
$reboot)
|
||||
run_cmd --reboot
|
||||
;;
|
||||
$lock)
|
||||
if command -v i3lock-color; then
|
||||
i3lock-color -c 808F85 && sleep 1
|
||||
# elif command -v betterlockscreen; then
|
||||
# betterlockscreen -l
|
||||
fi
|
||||
;;
|
||||
$suspend)
|
||||
run_cmd --suspend
|
||||
;;
|
||||
$logout)
|
||||
run_cmd --logout
|
||||
;;
|
||||
esac
|
||||
147
config/.config/rofi/menus/wifi/wifi.rasi
Executable file
147
config/.config/rofi/menus/wifi/wifi.rasi
Executable file
@@ -0,0 +1,147 @@
|
||||
/**
|
||||
*
|
||||
* Author : Marc Sastre, based on Aditya Shakya (adi1090x, Github : @adi1090x)
|
||||
*
|
||||
**/
|
||||
|
||||
@import "../../theme.rasi"
|
||||
|
||||
/*****----- Configuration -----*****/
|
||||
configuration {
|
||||
show-icons: false;
|
||||
}
|
||||
|
||||
/*****----- Main Window -----*****/
|
||||
window {
|
||||
/* properties for window widget */
|
||||
transparency: "real";
|
||||
location: center;
|
||||
anchor: center;
|
||||
fullscreen: false;
|
||||
width: 800px;
|
||||
x-offset: 0px;
|
||||
y-offset: 0px;
|
||||
|
||||
/* properties for all widgets */
|
||||
enabled: true;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: 2px solid;
|
||||
border-radius: 15px;
|
||||
border-color: @background-alt;
|
||||
cursor: "default";
|
||||
background-color: @background;
|
||||
}
|
||||
|
||||
/*****----- Main Box -----*****/
|
||||
mainbox {
|
||||
enabled: true;
|
||||
spacing: 15px;
|
||||
margin: 0px;
|
||||
padding: 30px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px;
|
||||
border-color: @selected;
|
||||
background-color: transparent;
|
||||
children: [ "inputbar", "listview" ];
|
||||
}
|
||||
message {
|
||||
enabled: true;
|
||||
margin: 0px;
|
||||
padding: 10px;
|
||||
border: 0px solid;
|
||||
border-radius: 10px;
|
||||
border-color: @selected;
|
||||
background-color: @background-alt;
|
||||
text-color: @foreground;
|
||||
}
|
||||
textbox {
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
vertical-align: 0.5;
|
||||
horizontal-align: 0.0;
|
||||
placeholder-color: @foreground;
|
||||
blink: true;
|
||||
markup: true;
|
||||
}
|
||||
|
||||
/*****----- Inputbar -----*****/
|
||||
inputbar {
|
||||
enabled: true;
|
||||
spacing: 10px;
|
||||
padding: 15px;
|
||||
border-radius: 10px;
|
||||
background-color: @background-alt;
|
||||
text-color: @foreground;
|
||||
children: [ "textbox-prompt-colon", "entry" ];
|
||||
}
|
||||
textbox-prompt-colon {
|
||||
enabled: true;
|
||||
expand: false;
|
||||
str: "直";
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
entry {
|
||||
enabled: true;
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
cursor: text;
|
||||
}
|
||||
|
||||
/*****----- Listview -----*****/
|
||||
listview {
|
||||
enabled: true;
|
||||
columns: 1;
|
||||
lines: 5;
|
||||
cycle: true;
|
||||
dynamic: true;
|
||||
scrollbar: false;
|
||||
layout: vertical;
|
||||
reverse: false;
|
||||
fixed-height: true;
|
||||
fixed-columns: true;
|
||||
|
||||
spacing: 5px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px;
|
||||
border-color: @selected;
|
||||
background-color: transparent;
|
||||
text-color: @foreground;
|
||||
cursor: "default";
|
||||
}
|
||||
|
||||
/*****----- Elements -----*****/
|
||||
element {
|
||||
enabled: true;
|
||||
spacing: 0px;
|
||||
margin: 0px;
|
||||
padding: 12px;
|
||||
border: 0px solid;
|
||||
border-radius: 100%;
|
||||
border-color: @selected;
|
||||
background-color: transparent;
|
||||
text-color: @foreground;
|
||||
cursor: pointer;
|
||||
}
|
||||
element-text {
|
||||
background-color: transparent;
|
||||
text-color: inherit;
|
||||
cursor: inherit;
|
||||
vertical-align: 0.5;
|
||||
horizontal-align: 0.0;
|
||||
}
|
||||
element selected.normal {
|
||||
background-color: var(selected);
|
||||
text-color: var(background);
|
||||
}
|
||||
element active {
|
||||
background-color: var(active);
|
||||
text-color: var(background);
|
||||
}
|
||||
element selected.active {
|
||||
background-color: var(selected);
|
||||
text-color: var(background);
|
||||
}
|
||||
83
config/.config/rofi/menus/wifi/wifi.sh
Executable file
83
config/.config/rofi/menus/wifi/wifi.sh
Executable file
@@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Shamelessly stolen from https://github.com/zbaylin/rofi-wifi-menu
|
||||
|
||||
# Starts a scan of available broadcasting SSIDs
|
||||
# nmcli dev wifi rescan
|
||||
|
||||
|
||||
# For debugging/development purposes
|
||||
# PREFIX=projects/samfelag/config/
|
||||
|
||||
# Rofi command to pipe into, can add any options here
|
||||
dir="$HOME/$PREFIX.config/rofi/menus/wifi/"
|
||||
theme='wifi'
|
||||
|
||||
rofi_command="rofi -dmenu -i -theme ${dir}/${theme}.rasi"
|
||||
|
||||
FIELDS=SSID,SECURITY,BARS
|
||||
|
||||
LIST=$(nmcli --fields "$FIELDS" device wifi list | sed '/^--/d')
|
||||
# Gives a list of known connections so we can parse it later
|
||||
KNOWNCON=$(nmcli connection show)
|
||||
# Really janky way of telling if there is currently a connection
|
||||
CONSTATE=$(nmcli -fields WIFI g)
|
||||
CURRSSID=$(LANGUAGE=C nmcli -t -f active,ssid dev wifi | awk -F: '$1 ~ /^yes/ {print $2}')
|
||||
|
||||
if [[ ! -z $CURRSSID ]]; then
|
||||
HIGHLINE=$(echo "$(echo "$LIST" | awk -F "[ ]{2,}" '{print $1}' | grep -Fxn -m 1 "$CURRSSID" | awk -F ":" '{print $1}') + 1" | bc )
|
||||
fi
|
||||
|
||||
if [[ "$CONSTATE" =~ "habilitat" ]]; then
|
||||
TOGGLE="toggle off"
|
||||
elif [[ "$CONSTATE" =~ "deshabilitat" ]]; then
|
||||
TOGGLE="toggle on"
|
||||
fi
|
||||
|
||||
|
||||
CHENTRY=$(echo -e "$TOGGLE\nmanual\n$LIST" | uniq -u | $rofi_command -p "Wi-Fi SSID: " -a "$HIGHLINE")
|
||||
#echo "$CHENTRY"
|
||||
CHSSID=$(echo "$CHENTRY" | sed 's/\s\{2,\}/\|/g' | awk -F "|" '{print $1}')
|
||||
#echo "$CHSSID"
|
||||
|
||||
# If the user inputs "manual" as their SSID in the start window, it will bring them to this screen
|
||||
if [ "$CHENTRY" = "manual" ] ; then
|
||||
# Manual entry of the SSID and password (if appplicable)
|
||||
MSSID=$(echo "enter the SSID of the network (SSID,password)" | $rofi_command -p "Manual Entry: " -lines 1)
|
||||
# Separating the password from the entered string
|
||||
MPASS=$(echo "$MSSID" | awk -F "," '{print $2}')
|
||||
|
||||
#echo "$MSSID"
|
||||
#echo "$MPASS"
|
||||
|
||||
# If the user entered a manual password, then use the password nmcli command
|
||||
if [ "$MPASS" = "" ]; then
|
||||
nmcli dev wifi con "$MSSID"
|
||||
else
|
||||
nmcli dev wifi con "$MSSID" password "$MPASS"
|
||||
fi
|
||||
|
||||
elif [ "$CHENTRY" = "toggle on" ]; then
|
||||
nmcli radio wifi on
|
||||
|
||||
elif [ "$CHENTRY" = "toggle off" ]; then
|
||||
nmcli radio wifi off
|
||||
|
||||
else
|
||||
|
||||
# If the connection is already in use, then this will still be able to get the SSID
|
||||
if [ "$CHSSID" = "*" ]; then
|
||||
CHSSID=$(echo "$CHENTRY" | sed 's/\s\{2,\}/\|/g' | awk -F "|" '{print $3}')
|
||||
fi
|
||||
|
||||
# Parses the list of preconfigured connections to see if it already contains the chosen SSID. This speeds up the connection process
|
||||
if [[ $(echo "$KNOWNCON" | grep "$CHSSID") = "$CHSSID" ]]; then
|
||||
nmcli con up "$CHSSID"
|
||||
else
|
||||
if [[ "$CHENTRY" =~ "WPA2" ]] || [[ "$CHENTRY" =~ "WEP" ]]; then
|
||||
WIFIPASS=$(echo "Enter password, if connection is stored, hit enter" | $rofi_command -p "Password: " -lines 1 )
|
||||
fi
|
||||
nmcli dev wifi con "$CHSSID" password "$WIFIPASS"
|
||||
fi
|
||||
|
||||
fi
|
||||
@@ -9,30 +9,21 @@
|
||||
(setq user-full-name "Marc Sastre Rienitz"
|
||||
user-mail-address "marc@sastre.cat")
|
||||
|
||||
;; Doom exposes five (optional) variables for controlling fonts in Doom. Here
|
||||
;; are the three important ones:
|
||||
;;
|
||||
;; + `doom-font'
|
||||
;; + `doom-variable-pitch-font'
|
||||
;; + `doom-big-font' -- used for `doom-big-font-mode'; use this for
|
||||
;; presentations or streaming.
|
||||
;;
|
||||
;; They all accept either a font-spec, font string ("Input Mono-12"), or xlfd
|
||||
;; font string. You generally only need these two:
|
||||
;; (setq doom-font (font-spec :family "monospace" :size 12 :weight 'semi-light)
|
||||
;; doom-variable-pitch-font (font-spec :family "sans" :size 13))
|
||||
(setq doom-font (font-spec :family "Iosevka" :size 15))
|
||||
(setq doom-unicode-font (font-spec :family "Iosevka Nerd Font" :size 15))
|
||||
|
||||
;; There are two ways to load a theme. Both assume the theme is installed and
|
||||
;; available. You can either set `doom-theme' or manually load a theme with the
|
||||
;; `load-theme' function. This is the default:
|
||||
(setq doom-theme 'doom-zenburn)
|
||||
|
||||
;; This determines the style of line numbers in effect. If set to `nil', line
|
||||
;; numbers are disabled. For relative line numbers, set this to `relative'.
|
||||
(setq display-line-numbers-type t)
|
||||
|
||||
;; Fonts
|
||||
(setq doom-font (font-spec :family "Iosevka" :size 15))
|
||||
(setq doom-unicode-font (font-spec :family "Iosevka Nerd Font" :size 15))
|
||||
|
||||
;; Themeing
|
||||
;; (load! "themes/base16-samfelag.el")
|
||||
(use-package base16-theme
|
||||
:init (add-to-list 'custom-theme-load-path "~/.config/doom/themes")
|
||||
:ensure t
|
||||
:config
|
||||
(load-theme 'base16-samfelag t))
|
||||
|
||||
;; Here are some additional functions/macros that could help you configure Doom:
|
||||
;;
|
||||
@@ -143,15 +134,16 @@
|
||||
;; -----------------------------------------------------------------------------
|
||||
;; Appearance - Prettify
|
||||
;; -----------------------------------------------------------------------------
|
||||
(load! "prettify-utils.el")
|
||||
(load! "modules/prettify-utils.el")
|
||||
|
||||
(pretty-hook python-mode
|
||||
;; ("def" "𝙛")
|
||||
;; ("class" "𝙘")
|
||||
("None" "∅")
|
||||
("lambda" "λ")
|
||||
("not in" "∉")
|
||||
("in" "∈"))
|
||||
'("None" "∅")
|
||||
'("lambda" "λ")
|
||||
'("not in" "∉")
|
||||
'("in" "∈"))
|
||||
|
||||
|
||||
(pretty-hook emacs-lisp-mode)
|
||||
;; ("defun" "𝙛")
|
||||
|
||||
@@ -87,14 +87,14 @@
|
||||
:tools
|
||||
;;ansible
|
||||
;;debugger ; FIXME stepping through code, to help you add bugs
|
||||
;;direnv
|
||||
direnv
|
||||
;;docker
|
||||
;;editorconfig ; let someone else argue about tabs vs spaces
|
||||
;;ein ; tame Jupyter notebooks with emacs
|
||||
(eval +overlay) ; run code, run (also, repls)
|
||||
;;gist ; interacting with github gists
|
||||
lookup ; navigate your code and its documentation
|
||||
;;lsp
|
||||
lsp
|
||||
magit ; a git porcelain for Emacs
|
||||
;;make ; run make tasks from Emacs
|
||||
;;pass ; password manager for nerds
|
||||
@@ -160,7 +160,8 @@
|
||||
rest ; Emacs as a REST client
|
||||
;;rst ; ReST in peace
|
||||
;;(ruby +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"}
|
||||
;;rust ; Fe2O3.unwrap().unwrap().unwrap().unwrap()
|
||||
(rust
|
||||
+lsp) ; Fe2O3.unwrap().unwrap().unwrap().unwrap()
|
||||
;;scala ; java, but good
|
||||
;;scheme ; a fully conniving family of lisps
|
||||
sh ; she sells {ba,z,fi}sh shells on the C xor
|
||||
|
||||
@@ -49,6 +49,8 @@
|
||||
;; ...Or *all* packages (NOT RECOMMENDED; will likely break things)
|
||||
;(unpin! t)
|
||||
|
||||
(package! base16-theme)
|
||||
|
||||
(package! parinfer)
|
||||
|
||||
;; Editor
|
||||
|
||||
25
config/doom/themes/base16-samfelag-theme.el
Normal file
25
config/doom/themes/base16-samfelag-theme.el
Normal file
@@ -0,0 +1,25 @@
|
||||
(require 'base16-theme)
|
||||
|
||||
(defvar base16-samfelag-theme-colors
|
||||
'(:base00 "#383838"
|
||||
:base01 "#404040"
|
||||
:base02 "#606060"
|
||||
:base03 "#6f6f6f"
|
||||
:base04 "#808080"
|
||||
:base05 "#dcdccc"
|
||||
:base06 "#c0c0c0"
|
||||
:base07 "#ffffff"
|
||||
:base08 "#dca3a3"
|
||||
:base09 "#dfaf8f"
|
||||
:base0A "#e0cf9f"
|
||||
:base0B "#5f7f5f"
|
||||
:base0C "#93e0e3"
|
||||
:base0D "#7cb8bb"
|
||||
:base0E "#dc8cc3"
|
||||
:base0F "#000000")
|
||||
"All colors for Base16 Samfelag are defined here.")
|
||||
|
||||
(deftheme base16-samfelag)
|
||||
(base16-theme-define 'base16-samfelag base16-samfelag-theme-colors)
|
||||
(provide-theme 'base16-samfelag)
|
||||
(provide 'base16-samfelag-theme)
|
||||
BIN
data/wallpapers/globus.jpg
Normal file
BIN
data/wallpapers/globus.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 179 KiB |
BIN
data/wallpapers/prat.jpg
Normal file
BIN
data/wallpapers/prat.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.0 MiB |
BIN
data/wallpapers/rosa.jpg
Normal file
BIN
data/wallpapers/rosa.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.7 MiB |
75
flake.lock
generated
75
flake.lock
generated
@@ -1,16 +1,32 @@
|
||||
{
|
||||
"nodes": {
|
||||
"base16-schemes": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1654895891,
|
||||
"narHash": "sha256-xYYmZkHnyLCUBAkqkZ7v1Lc5m39857MukQLMRtGuvdk=",
|
||||
"owner": "base16-project",
|
||||
"repo": "base16-schemes",
|
||||
"rev": "7c247f734eac7f04518c6e28d098635ee8dcabf5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "base16-project",
|
||||
"repo": "base16-schemes",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"emacs-overlay": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1667735920,
|
||||
"narHash": "sha256-EfkJxfLX6vVZfNR/7gZgIgwafJ+6RxHwBKp337i09gA=",
|
||||
"lastModified": 1669120813,
|
||||
"narHash": "sha256-00O/dvvcELCdpuFPde+bsJ9Bw974b/VunUArWlJ+lQA=",
|
||||
"owner": "nix-community",
|
||||
"repo": "emacs-overlay",
|
||||
"rev": "c009b388c8c2514b24baf6231c5612192c25745c",
|
||||
"rev": "a9c2a436757f09abc4c7bc0abc4d2529b312e42b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -41,11 +57,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1656169755,
|
||||
"narHash": "sha256-Nlnm4jeQWEGjYrE6hxi/7HYHjBSZ/E0RtjCYifnNsWk=",
|
||||
"lastModified": 1667907331,
|
||||
"narHash": "sha256-bHkAwkYlBjkupPUFcQjimNS8gxWSWjOTevEuwdnp5m0=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "4a3d01fb53f52ac83194081272795aa4612c2381",
|
||||
"rev": "6639e3a837fc5deb6f99554072789724997bc8e5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -55,13 +71,32 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-colors": {
|
||||
"inputs": {
|
||||
"base16-schemes": "base16-schemes",
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1667165773,
|
||||
"narHash": "sha256-47gEPN7UKrNM+a3OKAFtNQeyc1/sSPgDm3OGCgphCyo=",
|
||||
"owner": "misterio77",
|
||||
"repo": "nix-colors",
|
||||
"rev": "a58fb210eb285920ec10f204d007185b3629cadc",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "misterio77",
|
||||
"repo": "nix-colors",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1667639549,
|
||||
"narHash": "sha256-frqZKSG/933Ctwl9voSZnXDwo8CqddXcjQhnCzwNqaM=",
|
||||
"lastModified": 1669076005,
|
||||
"narHash": "sha256-uzMji2q9Pk3jUH+e5nEFtoOZCP4VV1PDRJRLVmriY0M=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "cae3751e9f74eea29c573d6c2f14523f41c2821a",
|
||||
"rev": "69335c46c48a73f291d5c6f332fb9fe8b8e22b30",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -69,13 +104,28 @@
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"lastModified": 1655599917,
|
||||
"narHash": "sha256-kjZbt5WdTrnjMxL79okg9TCoRUdADG50x/TWozbyTsE=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"rev": "5fb55578aa2f1a502d636a8ac71aece57cb730bb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1664594436,
|
||||
"narHash": "sha256-YHowMADGzdi7fKnGlg47qe0PIljq+11VqLarmXDuKxQ=",
|
||||
"lastModified": 1668984258,
|
||||
"narHash": "sha256-0gDMJ2T3qf58xgcSbYoXiRGUkPWmKyr5C3vcathWhKs=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "9cac45850280978a21a3eb67b15a18f34cbffa2d",
|
||||
"rev": "cf63ade6f74bbc9d2a017290f1b2e33e8fbfa70a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -89,6 +139,7 @@
|
||||
"inputs": {
|
||||
"emacs-overlay": "emacs-overlay",
|
||||
"home-manager": "home-manager",
|
||||
"nix-colors": "nix-colors",
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
}
|
||||
}
|
||||
|
||||
65
flake.nix
65
flake.nix
@@ -8,6 +8,8 @@
|
||||
home-manager.url = "github:nix-community/home-manager/release-22.05";
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
nix-colors.url = "github:misterio77/nix-colors";
|
||||
|
||||
emacs-overlay.url = "github:nix-community/emacs-overlay";
|
||||
|
||||
};
|
||||
@@ -15,54 +17,35 @@
|
||||
outputs = inputs @ { self, nixpkgs, home-manager, ... }:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
config.allowUnfree = true;
|
||||
overlays = import ./overlays;
|
||||
};
|
||||
|
||||
lib = nixpkgs.lib.extend
|
||||
(self: super: { my = import ./lib { inherit pkgs inputs; lib = self; }; });
|
||||
|
||||
mkHost = hostPath: lib.nixosSystem {
|
||||
inherit system;
|
||||
inherit pkgs;
|
||||
specialArgs = { inherit lib inputs system; };
|
||||
modules = [
|
||||
hostPath
|
||||
{
|
||||
imports =
|
||||
[
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
inputs.nix-colors.homeManagerModule
|
||||
]
|
||||
# All my personal modules
|
||||
++ (lib.my.mapModulesRec' (toString ./modules) import);
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
in {
|
||||
nixosConfigurations = {
|
||||
|
||||
# - Reykjavik ----------------------------
|
||||
reykjavik = lib.nixosSystem {
|
||||
inherit system;
|
||||
inherit pkgs;
|
||||
specialArgs = { inherit lib inputs system; };
|
||||
modules = [
|
||||
|
||||
./hosts/reykjavik
|
||||
|
||||
{
|
||||
imports =
|
||||
[ inputs.home-manager.nixosModules.home-manager ]
|
||||
# All my personal modules
|
||||
++ (lib.my.mapModulesRec' (toString ./modules) import);
|
||||
}
|
||||
|
||||
];
|
||||
};
|
||||
|
||||
# - Kopavogur ----------------------------
|
||||
kopavogur = lib.nixosSystem {
|
||||
inherit system;
|
||||
inherit pkgs;
|
||||
specialArgs = { inherit lib inputs system; };
|
||||
modules = [
|
||||
|
||||
./hosts/kopavogur
|
||||
|
||||
{
|
||||
imports =
|
||||
[ inputs.home-manager.nixosModules.home-manager ]
|
||||
# All my personal modules
|
||||
++ (lib.my.mapModulesRec' (toString ./modules) import);
|
||||
}
|
||||
|
||||
];
|
||||
};
|
||||
|
||||
};
|
||||
nixosConfigurations = lib.my.mapModules ./hosts mkHost;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -24,12 +24,12 @@
|
||||
# See modules/common.nix for common packages installed
|
||||
|
||||
# - System -----------------------------------
|
||||
system.utils.enable = true;
|
||||
|
||||
# - Desktop ----------------------------------
|
||||
desktop = {
|
||||
enable = true;
|
||||
laptop = true;
|
||||
|
||||
};
|
||||
|
||||
# - Editors and development ------------------
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
{ config, pkgs, lib, inputs, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
nix-colors-lib = inputs.nix-colors.lib-contrib { inherit pkgs; };
|
||||
wallpaper = ../../data/wallpapers/globus.jpg;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
./hardware.nix
|
||||
./nvidia.nix
|
||||
];
|
||||
|
||||
# - Basic --------------------------------------
|
||||
@@ -16,6 +20,13 @@
|
||||
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
|
||||
# - Themeing ---------------------------------
|
||||
|
||||
colorScheme = nix-colors-lib.colorSchemeFromPicture {
|
||||
path = wallpaper;
|
||||
kind = "dark";
|
||||
};
|
||||
|
||||
# - Modules ------------------------------------
|
||||
|
||||
samfelag.modules = {
|
||||
@@ -23,13 +34,19 @@
|
||||
# See modules/common.nix for common packages installed
|
||||
|
||||
# - System -----------------------------------
|
||||
system.utils.enable = true;
|
||||
system.bluetooth.enable = true;
|
||||
system.nvidia = {
|
||||
enable = true;
|
||||
intelBusId = "PCI:0:2:0";
|
||||
nvidiaBusId = "PCI:1:0:0";
|
||||
};
|
||||
|
||||
# - Desktop ----------------------------------
|
||||
desktop = {
|
||||
inherit wallpaper;
|
||||
enable = true;
|
||||
laptop = true;
|
||||
|
||||
};
|
||||
|
||||
# - Editors and development ------------------
|
||||
@@ -37,6 +54,7 @@
|
||||
|
||||
dev.git.userName = "marc";
|
||||
dev.git.userEmail = "marc@sastre.cat";
|
||||
dev.direnv.enable = true;
|
||||
|
||||
# - Other apps -------------------------------
|
||||
app.spotify.enable = true;
|
||||
|
||||
@@ -38,4 +38,9 @@
|
||||
|
||||
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
|
||||
# # Keyboard light
|
||||
# services.udev.extraRules = ''
|
||||
# SUBSYSTEM=="usb", ATTR{idVendor}=="048d", ATTR{idProduct}=="c101", MODE="0666"
|
||||
# '';
|
||||
}
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
let
|
||||
nvidia-offload = pkgs.writeShellScriptBin "nvidia-offload" ''
|
||||
export __NV_PRIME_RENDER_OFFLOAD=1
|
||||
export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0
|
||||
export __GLX_VENDOR_LIBRARY_NAME=nvidia
|
||||
export __VK_LAYER_NV_optimus=NVIDIA_only
|
||||
exec "$@"
|
||||
'';
|
||||
in
|
||||
{
|
||||
environment.systemPackages = [ nvidia-offload ];
|
||||
|
||||
services.xserver.videoDrivers = [ "nvidia" ];
|
||||
|
||||
hardware.opengl.enable = true;
|
||||
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable;
|
||||
|
||||
hardware.nvidia.prime = {
|
||||
offload.enable = true;
|
||||
|
||||
# Bus ID of the Intel GPU. You can find it using lspci, either under 3D or VGA
|
||||
intelBusId = "PCI:0:2:0";
|
||||
|
||||
# Bus ID of the NVIDIA GPU. You can find it using lspci, either under 3D or VGA
|
||||
nvidiaBusId = "PCI:1:0:0";
|
||||
};
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
let
|
||||
cfg = config.samfelag.modules.app.alacritty;
|
||||
i3Cfg = config.samfelag.modules.desktop.i3;
|
||||
in
|
||||
{
|
||||
options.samfelag.modules.app.alacritty = {
|
||||
@@ -9,10 +10,46 @@ in
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
fonts.fontconfig.enable = true;
|
||||
|
||||
hm.home.packages = with pkgs; [
|
||||
alacritty
|
||||
(nerdfonts.override { fonts = [ "Iosevka" ]; })
|
||||
];
|
||||
hm.xdg.configFile."alacritty".source = ../../config/.config/alacritty;
|
||||
|
||||
hm.xdg.configFile."alacritty/alacritty.yml".source = ../../config/.config/alacritty/alacritty.yml;
|
||||
|
||||
# - Themeing ---------------------------------
|
||||
hm.xdg.configFile."alacritty/theme.yml".text = ''
|
||||
colors:
|
||||
primary:
|
||||
background: '0x${config.colorScheme.colors.base00}'
|
||||
foreground: '0x${config.colorScheme.colors.base05}'
|
||||
cursor:
|
||||
text: '0x${config.colorScheme.colors.base00}'
|
||||
cursor: '0x${config.colorScheme.colors.base05}'
|
||||
normal:
|
||||
black: '0x${config.colorScheme.colors.base00}'
|
||||
red: '0x${config.colorScheme.colors.base08}'
|
||||
green: '0x${config.colorScheme.colors.base0B}'
|
||||
yellow: '0x${config.colorScheme.colors.base0A}'
|
||||
blue: '0x${config.colorScheme.colors.base0D}'
|
||||
magenta: '0x${config.colorScheme.colors.base0E}'
|
||||
cyan: '0x${config.colorScheme.colors.base0C}'
|
||||
white: '0x${config.colorScheme.colors.base05}'
|
||||
bright:
|
||||
black: '0x${config.colorScheme.colors.base03}'
|
||||
red: '0x${config.colorScheme.colors.base09}'
|
||||
green: '0x${config.colorScheme.colors.base01}'
|
||||
yellow: '0x${config.colorScheme.colors.base02}'
|
||||
blue: '0x${config.colorScheme.colors.base04}'
|
||||
magenta: '0x${config.colorScheme.colors.base06}'
|
||||
cyan: '0x${config.colorScheme.colors.base0F}'
|
||||
white: '0x${config.colorScheme.colors.base07}'
|
||||
draw_bold_text_with_bright_colors: false
|
||||
'';
|
||||
|
||||
samfelag.modules.desktop.i3.extraKeybindings = lib.mkIf i3Cfg.enable {
|
||||
"${i3Cfg.mod}+Return" = "exec ${pkgs.alacritty}/bin/alacritty";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
20
modules/app/firefox.nix
Normal file
20
modules/app/firefox.nix
Normal file
@@ -0,0 +1,20 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.samfelag.modules.app.firefox;
|
||||
i3Cfg = config.samfelag.modules.desktop.i3;
|
||||
in
|
||||
{
|
||||
options.samfelag.modules.app.firefox = {
|
||||
enable = lib.mkEnableOption "firefox";
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
firefox
|
||||
];
|
||||
|
||||
samfelag.modules.desktop.i3.extraKeybindings = lib.mkIf i3Cfg.enable {
|
||||
"${i3Cfg.mod}+Shift+i" = "exec ${pkgs.firefox}/bin/firefox";
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
let
|
||||
cfg = config.samfelag.modules.app.spotify;
|
||||
i3Cfg = config.samfelag.modules.desktop.i3;
|
||||
in
|
||||
{
|
||||
options.samfelag.modules.app.spotify = {
|
||||
@@ -11,5 +12,9 @@ in
|
||||
hm.home.packages = with pkgs; [
|
||||
spotify
|
||||
];
|
||||
|
||||
samfelag.modules.desktop.i3.extraKeybindings = lib.mkIf i3Cfg.enable {
|
||||
"${i3Cfg.mod}+Shift+m" = "exec ${pkgs.spotify}/bin/spotify";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -39,11 +39,9 @@
|
||||
environment.pathsToLink = [ "/libexec" ];
|
||||
environment.systemPackages = with pkgs; [
|
||||
curl
|
||||
git
|
||||
htop
|
||||
pciutils
|
||||
psmisc
|
||||
vim
|
||||
];
|
||||
|
||||
# - Modules ------------------------------------
|
||||
@@ -53,6 +51,7 @@
|
||||
samfelag.modules = {
|
||||
shell.utils.enable = true;
|
||||
shell.zsh.enable = true;
|
||||
editors.vim.enable = true;
|
||||
dev.git.enable = true;
|
||||
|
||||
# May go away from common if not all hosts use it
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{ config, lib, pkgs, inputs, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
@@ -16,6 +16,8 @@ in
|
||||
type = types.bool;
|
||||
default = false;
|
||||
};
|
||||
|
||||
wallpaper = my.mkOpt' types.path ../../data/wallpaper/flors "Path to wallpaper(s)";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
@@ -28,8 +30,6 @@ in
|
||||
brightnessctl
|
||||
playerctl
|
||||
feh
|
||||
rofi
|
||||
firefox
|
||||
] ++ optionals cfg.laptop laptopPkgs;
|
||||
|
||||
# - Audio ------------------------------------
|
||||
@@ -51,18 +51,27 @@ in
|
||||
# - Modules ----------------------------------
|
||||
|
||||
samfelag.modules = {
|
||||
|
||||
app.alacritty.enable = true;
|
||||
desktop.rofi.enable = true;
|
||||
desktop.polybar.enable = true;
|
||||
app.firefox.enable = true;
|
||||
|
||||
desktop.i3 = {
|
||||
enable = true;
|
||||
laptop = cfg.laptop;
|
||||
launcher.command = "${pkgs.rofi}/bin/rofi rofi -show run";
|
||||
terminal.command = "${pkgs.alacritty}/bin/alacritty";
|
||||
browser.command = "${pkgs.firefox}/bin/firefox";
|
||||
locker.command = "${pkgs.i3lock-blur}/bin/i3lock-color -c 808F85 && sleep 1";
|
||||
|
||||
extraStartup = [
|
||||
{ command = "systemctl --user restart polybar"; always = true; notification = false; }
|
||||
{ command = "feh --bg-fill -B \"#${config.colorScheme.colors.base00}\" -z --no-fehbg ${cfg.wallpaper}"; always = true; notification = false; }
|
||||
];
|
||||
|
||||
extraKeybindings = {
|
||||
"${cfg.i3.mod}+space" = "exec $HOME/.config/rofi/menus/launcher/launcher.sh";
|
||||
"${cfg.i3.mod}+End" = "exec $HOME/.config/rofi/menus/powermenu/powermenu.sh";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3,51 +3,18 @@
|
||||
let
|
||||
cfg = config.samfelag.modules.desktop.i3;
|
||||
mod = "Mod4";
|
||||
|
||||
cmdModule = lib.types.submodule ({ ... }: {
|
||||
options = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
};
|
||||
command = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
example = "${pkgs.rofi}/bin/rofi rofi -show run";
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
system_mode = "System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown";
|
||||
|
||||
bg_colour = "#808F85";
|
||||
|
||||
paths = {
|
||||
wallpapers = ../../data/wallpapers;
|
||||
};
|
||||
|
||||
in {
|
||||
|
||||
options.samfelag.modules.desktop.i3 = {
|
||||
enable = lib.mkEnableOption "i3 window manager";
|
||||
options.samfelag.modules.desktop.i3 = with lib; {
|
||||
enable = mkEnableOption "i3 window manager";
|
||||
|
||||
laptop = lib.mkOption {
|
||||
description = "Enable features for a laptop (trackpad, battery, etc...)";
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
mod = my.mkOpt' types.str "Mod4" "Main modifier key for i3";
|
||||
|
||||
laptop = mkEnableOption "Enable features for a laptop (trackpad, battery, etc...)";
|
||||
|
||||
extraKeybindings = my.mkOpt (types.attrsOf types.str) {};
|
||||
extraStartup = my.mkOpt (types.listOf types.attrs) [ ];
|
||||
|
||||
launcher = lib.mkOption {
|
||||
type = cmdModule;
|
||||
};
|
||||
terminal = lib.mkOption {
|
||||
type = cmdModule;
|
||||
};
|
||||
browser = lib.mkOption {
|
||||
type = cmdModule;
|
||||
};
|
||||
locker = lib.mkOption {
|
||||
type = cmdModule;
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
@@ -56,10 +23,9 @@ in {
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
(nerdfonts.override { fonts = [ "Iosevka" ]; })
|
||||
playerctl
|
||||
];
|
||||
|
||||
hm.xdg.dataFile."wallpapers".source = paths.wallpapers;
|
||||
|
||||
services.xserver = {
|
||||
enable = true;
|
||||
|
||||
@@ -88,6 +54,7 @@ in {
|
||||
};
|
||||
|
||||
windowManager.i3.enable = true;
|
||||
windowManager.i3.package = pkgs.i3-gaps;
|
||||
};
|
||||
|
||||
# - Configuration ----------------------------
|
||||
@@ -113,16 +80,14 @@ in {
|
||||
titlebar = false;
|
||||
};
|
||||
|
||||
# gaps = {
|
||||
# inner = 10;
|
||||
# outer = 5;
|
||||
# };
|
||||
gaps = {
|
||||
inner = 10;
|
||||
outer = 0;
|
||||
};
|
||||
|
||||
startup = [
|
||||
{ command = "i3-msg workspace 1"; }
|
||||
{ command = "systemctl --user restart polybar"; always = true; notification = false; }
|
||||
{ command = "feh --bg-center -B \"${bg_colour}\" -z --no-fehbg ${paths.wallpapers}/flors"; always = true; notification = false; }
|
||||
];
|
||||
] ++ cfg.extraStartup;
|
||||
|
||||
modes = {
|
||||
"resize" = {
|
||||
@@ -139,18 +104,6 @@ in {
|
||||
"Return" = "mode \"default\"";
|
||||
"Escape" = "mode \"default\"";
|
||||
};
|
||||
|
||||
"${system_mode}" = {
|
||||
"l" = "exec --no-startup-id ${cfg.locker.command}, mode \"default\"";
|
||||
"e" = "exec --no-startup-id i3-msg exit, mode \"default\"";
|
||||
"s" = "exec --no-startup-id ${cfg.locker.command} && systemctl suspend, mode \"default\"";
|
||||
"h" = "exec --no-startup-id ${cfg.locker.command} && systemctl hibernate, mode \"default\"";
|
||||
"r" = "exec --no-startup-id systemctl reboot, mode \"default\"";
|
||||
"Shift+s" = "exec --no-startup-id systemctl poweroff -i, mode \"default\"";
|
||||
|
||||
"Return" = "mode \"default\"";
|
||||
"Escape" = "mode \"default\"";
|
||||
};
|
||||
};
|
||||
|
||||
keybindings = {
|
||||
@@ -200,7 +153,6 @@ in {
|
||||
|
||||
# - Modes ------------------------------
|
||||
"${mod}+r" = "mode \"resize\"";
|
||||
"${mod}+End" = "mode \"${system_mode}\"";
|
||||
|
||||
# - Media ------------------------------
|
||||
|
||||
@@ -240,17 +192,40 @@ in {
|
||||
"${mod}+Shift+8" = "move container to workspace 8; workspace 8";
|
||||
"${mod}+Shift+9" = "move container to workspace 9; workspace 9";
|
||||
"${mod}+Shift+0" = "move container to workspace 10; workspace 10";
|
||||
} // cfg.extraKeybindings;
|
||||
|
||||
}
|
||||
// (if cfg.terminal.enable then {
|
||||
"${mod}+Return" = "exec ${cfg.terminal.command}";
|
||||
} else {})
|
||||
// (if cfg.launcher.enable then {
|
||||
"${mod}+space" = "exec ${cfg.launcher.command}";
|
||||
} else {})
|
||||
// (if cfg.browser.enable then {
|
||||
"${mod}+Control+3" = "exec ${cfg.browser.command}";
|
||||
} else {});
|
||||
# - Themeing ---------------------------------
|
||||
colors = {
|
||||
background = "#${config.colorScheme.colors.base00}";
|
||||
focused = {
|
||||
border = "#${config.colorScheme.colors.base03}";
|
||||
background = "#${config.colorScheme.colors.base0B}";
|
||||
text = "#${config.colorScheme.colors.base03}";
|
||||
indicator = "#${config.colorScheme.colors.base04}";
|
||||
childBorder = "#${config.colorScheme.colors.base03}";
|
||||
};
|
||||
focusedInactive = {
|
||||
border = "#${config.colorScheme.colors.base03}";
|
||||
background = "#${config.colorScheme.colors.base04}";
|
||||
text = "#${config.colorScheme.colors.base03}";
|
||||
indicator = "#${config.colorScheme.colors.base04}";
|
||||
childBorder = "#${config.colorScheme.colors.base03}";
|
||||
};
|
||||
unfocused = {
|
||||
border = "#${config.colorScheme.colors.base02}";
|
||||
background = "#${config.colorScheme.colors.base01}";
|
||||
text = "#${config.colorScheme.colors.base03}";
|
||||
indicator = "#${config.colorScheme.colors.base03}";
|
||||
childBorder = "#${config.colorScheme.colors.base02}";
|
||||
};
|
||||
urgent = {
|
||||
border = "#${config.colorScheme.colors.base02}";
|
||||
background = "#${config.colorScheme.colors.base0A}";
|
||||
text = "#${config.colorScheme.colors.base02}";
|
||||
indicator = "#${config.colorScheme.colors.base03}";
|
||||
childBorder = "#${config.colorScheme.colors.base02}";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
let
|
||||
cfg = config.samfelag.modules.desktop.polybar;
|
||||
i3Cfg = config.samfelag.modules.desktop.i3;
|
||||
polybar_pkg = pkgs.polybar.override {
|
||||
i3Support = true;
|
||||
pulseSupport = true;
|
||||
@@ -34,6 +35,37 @@ in {
|
||||
hm.xdg.configFile."polybar/bars".source = paths.bars;
|
||||
hm.xdg.configFile."polybar/scripts".source = paths.scripts;
|
||||
|
||||
# - Themeing ---------------------------------
|
||||
hm.xdg.configFile."polybar/colour-scheme.ini".text = ''
|
||||
[colour-scheme]
|
||||
base00 = #${config.colorScheme.colors.base00}
|
||||
base01 = #${config.colorScheme.colors.base01}
|
||||
base02 = #${config.colorScheme.colors.base02}
|
||||
base03 = #${config.colorScheme.colors.base03}
|
||||
base04 = #${config.colorScheme.colors.base04}
|
||||
base05 = #${config.colorScheme.colors.base05}
|
||||
base06 = #${config.colorScheme.colors.base06}
|
||||
base07 = #${config.colorScheme.colors.base07}
|
||||
base08 = #${config.colorScheme.colors.base08}
|
||||
base09 = #${config.colorScheme.colors.base09}
|
||||
base0A = #${config.colorScheme.colors.base0A}
|
||||
base0B = #${config.colorScheme.colors.base0B}
|
||||
base0C = #${config.colorScheme.colors.base0C}
|
||||
base0D = #${config.colorScheme.colors.base0D}
|
||||
base0E = #${config.colorScheme.colors.base0E}
|
||||
base0F = #${config.colorScheme.colors.base0F}
|
||||
'';
|
||||
|
||||
# - Dependencies -----------------------------
|
||||
|
||||
# The polybar modules use rofi
|
||||
samfelag.modules.desktop.rofi.enable = true;
|
||||
samfelag.modules.desktop.i3.extraKeybindings = lib.mkIf i3Cfg.enable {
|
||||
"${i3Cfg.mod}+Shift+w" = "exec $HOME/.config/rofi/menus/wifi/wifi.sh";
|
||||
};
|
||||
|
||||
# - Services ---------------------------------
|
||||
|
||||
hm.systemd.user.services.polybar = {
|
||||
Unit = {
|
||||
Description = "Polybar status bar";
|
||||
|
||||
31
modules/desktop/rofi.nix
Normal file
31
modules/desktop/rofi.nix
Normal file
@@ -0,0 +1,31 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.samfelag.modules.desktop.rofi;
|
||||
in
|
||||
{
|
||||
options.samfelag.modules.desktop.rofi = {
|
||||
enable = lib.mkEnableOption "rofi";
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
rofi
|
||||
];
|
||||
|
||||
hm.xdg.configFile."rofi/menus".source = ../../config/.config/rofi/menus;
|
||||
|
||||
# Themeing ---------------------------------
|
||||
hm.xdg.configFile."rofi/theme.rasi".text = ''
|
||||
* {
|
||||
font: "Iosevka Nerd Font 10";
|
||||
background: #${config.colorScheme.colors.base00};
|
||||
background-alt: #${config.colorScheme.colors.base01};
|
||||
foreground: #${config.colorScheme.colors.base05};
|
||||
selected: #${config.colorScheme.colors.base02};
|
||||
active: #${config.colorScheme.colors.base07};
|
||||
urgent: #${config.colorScheme.colors.base06};
|
||||
}
|
||||
'';
|
||||
|
||||
};
|
||||
}
|
||||
22
modules/dev/direnv.nix
Normal file
22
modules/dev/direnv.nix
Normal file
@@ -0,0 +1,22 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.samfelag.modules.dev.direnv;
|
||||
in
|
||||
{
|
||||
options.samfelag.modules.dev.direnv = {
|
||||
enable = lib.mkEnableOption "direnv";
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
hm.programs.direnv = {
|
||||
enable = true;
|
||||
nix-direnv.enable = true;
|
||||
};
|
||||
|
||||
# Optional: To protect your nix-shell against garbage collection
|
||||
nix.extraOptions = ''
|
||||
keep-outputs = true
|
||||
keep-derivations = true
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -3,6 +3,11 @@
|
||||
with lib;
|
||||
let
|
||||
cfg = config.samfelag.modules.editors.emacs;
|
||||
i3Cfg = config.samfelag.modules.desktop.i3;
|
||||
emacsPackages = epkgs: [
|
||||
epkgs.vterm
|
||||
];
|
||||
emacsWithPackages = with pkgs; ((emacsPackagesFor emacsNativeComp).emacsWithPackages emacsPackages);
|
||||
in {
|
||||
options.samfelag.modules.editors.emacs = {
|
||||
enable = mkEnableOption "emacs";
|
||||
@@ -11,30 +16,11 @@ in {
|
||||
config = mkIf cfg.enable {
|
||||
nixpkgs.overlays = [ inputs.emacs-overlay.overlay ];
|
||||
|
||||
# home.file.doom-emacs = {
|
||||
# source = ./doom-emacs;
|
||||
# target = ".config/doom";
|
||||
# recursive = true;
|
||||
# # onChange = "doom upgrade";
|
||||
# };
|
||||
|
||||
# home.programs.emacs = {
|
||||
# enable = true;
|
||||
# # package = pkgs.emacsPgtkGcc;
|
||||
# extraPackages = epkgs: [ epkgs.vterm ];
|
||||
# };
|
||||
|
||||
# home.services.emacs = {
|
||||
# enable = true;
|
||||
# client.enable = true;
|
||||
# socketActivation.enable = true;
|
||||
# };
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
## Emacs itself
|
||||
binutils
|
||||
((emacsPackagesFor emacsNativeComp).emacsWithPackages
|
||||
(epkgs: [ epkgs.vterm ]))
|
||||
emacsWithPackages
|
||||
|
||||
# emacsPgtkGcc
|
||||
|
||||
## Doom dependencies
|
||||
@@ -92,9 +78,43 @@ in {
|
||||
|
||||
fonts.fonts = [ pkgs.emacs-all-the-icons-fonts ];
|
||||
|
||||
env.PATH = [ "$XDG_CONFIG_HOME/emacs/bin" ];
|
||||
env.PATH = [ "$HOME/.config/emacs/bin" ];
|
||||
|
||||
hm.xdg.configFile = {
|
||||
"doom/modules".source = ../../config/doom/modules;
|
||||
"doom/config.el".source = ../../config/doom/config.el;
|
||||
"doom/custom.el".source = ../../config/doom/custom.el;
|
||||
"doom/init.el".source = ../../config/doom/init.el;
|
||||
"doom/packages.el".source = ../../config/doom/packages.el;
|
||||
|
||||
# Themeing
|
||||
"doom/themes/base16-samfelag-theme.el".text = ''
|
||||
(require 'base16-theme)
|
||||
(defvar base16-samfelag-theme-colors
|
||||
'(:base00 "#${config.colorScheme.colors.base00}"
|
||||
:base01 "#${config.colorScheme.colors.base01}"
|
||||
:base02 "#${config.colorScheme.colors.base02}"
|
||||
:base03 "#${config.colorScheme.colors.base03}"
|
||||
:base04 "#${config.colorScheme.colors.base04}"
|
||||
:base05 "#${config.colorScheme.colors.base05}"
|
||||
:base06 "#${config.colorScheme.colors.base06}"
|
||||
:base07 "#${config.colorScheme.colors.base07}"
|
||||
:base08 "#${config.colorScheme.colors.base08}"
|
||||
:base09 "#${config.colorScheme.colors.base09}"
|
||||
:base0A "#${config.colorScheme.colors.base0A}"
|
||||
:base0B "#${config.colorScheme.colors.base0B}"
|
||||
:base0C "#${config.colorScheme.colors.base0C}"
|
||||
:base0D "#${config.colorScheme.colors.base0D}"
|
||||
:base0E "#${config.colorScheme.colors.base0E}"
|
||||
:base0F "#${config.colorScheme.colors.base0F}")
|
||||
"All colors for Base16 Samfelag are defined here.")
|
||||
(deftheme base16-samfelag)
|
||||
(base16-theme-define 'base16-samfelag base16-samfelag-theme-colors)
|
||||
(provide-theme 'base16-samfelag)
|
||||
(provide 'base16-samfelag-theme)
|
||||
'';
|
||||
};
|
||||
|
||||
home-manager.users.marc.xdg.configFile."doom".source = ../../config/doom;
|
||||
|
||||
system.userActivationScripts = {
|
||||
installDoomEmacs = ''
|
||||
@@ -107,5 +127,9 @@ in {
|
||||
'';
|
||||
};
|
||||
|
||||
samfelag.modules.desktop.i3.extraKeybindings = lib.mkIf i3Cfg.enable {
|
||||
"${i3Cfg.mod}+Shift+e" = "exec ${emacsWithPackages}/bin/emacs";
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
15
modules/editors/vim.nix
Normal file
15
modules/editors/vim.nix
Normal file
@@ -0,0 +1,15 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.samfelag.modules.editors.vim;
|
||||
in
|
||||
{
|
||||
options.samfelag.modules.editors.vim = {
|
||||
enable = lib.mkEnableOption "vim";
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
vim
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -24,7 +24,7 @@ with lib.my;
|
||||
config = {
|
||||
user = {
|
||||
description = "The primary user account";
|
||||
extraGroups = [ "wheel" ];
|
||||
extraGroups = [ "wheel" "networkmanager" ];
|
||||
isNormalUser = true;
|
||||
home = "/home/${config.user.name}";
|
||||
group = "users";
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
let
|
||||
cfg = config.samfelag.modules.system.bluetooth;
|
||||
desktopCfg = config.samfelag.modules.desktop;
|
||||
in
|
||||
{
|
||||
options.samfelag.modules.system.bluetooth = {
|
||||
@@ -10,5 +11,9 @@ in
|
||||
config = lib.mkIf cfg.enable {
|
||||
hardware.bluetooth.enable = true;
|
||||
services.blueman.enable = true;
|
||||
|
||||
samfelag.modules.desktop.i3.extraKeybindings = lib.mkIf desktopCfg.enable {
|
||||
"${desktopCfg.i3.mod}+b" = "exec $HOME/.config/rofi/menus/bluetooth/bluetooth.sh";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
39
modules/system/nvidia.nix
Normal file
39
modules/system/nvidia.nix
Normal file
@@ -0,0 +1,39 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
nvidia-offload = pkgs.writeShellScriptBin "nvidia-offload" ''
|
||||
export __NV_PRIME_RENDER_OFFLOAD=1
|
||||
export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0
|
||||
export __GLX_VENDOR_LIBRARY_NAME=nvidia
|
||||
export __VK_LAYER_NV_optimus=NVIDIA_only
|
||||
exec "$@"
|
||||
'';
|
||||
cfg = config.samfelag.modules.system.nvidia;
|
||||
in
|
||||
{
|
||||
options.samfelag.modules.system.nvidia = {
|
||||
enable = lib.mkEnableOption "nvidia";
|
||||
|
||||
intelBusId = lib.mkOption { type = lib.types.str; };
|
||||
nvidiaBusId = lib.mkOption { type = lib.types.str; };
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = [ nvidia-offload ];
|
||||
|
||||
services.xserver.videoDrivers = [ "nvidia" ];
|
||||
|
||||
hardware.opengl.enable = true;
|
||||
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable;
|
||||
|
||||
hardware.nvidia.prime = {
|
||||
offload.enable = true;
|
||||
|
||||
# Bus ID of the Intel GPU. You can find it using lspci, either under 3D or VGA
|
||||
intelBusId = cfg.intelBusId;
|
||||
|
||||
# Bus ID of the NVIDIA GPU. You can find it using lspci, either under 3D or VGA
|
||||
nvidiaBusId = cfg.nvidiaBusId;
|
||||
};
|
||||
};
|
||||
}
|
||||
17
modules/system/utils.nix
Normal file
17
modules/system/utils.nix
Normal file
@@ -0,0 +1,17 @@
|
||||
{ config, lib, pkgs, self, ... }:
|
||||
|
||||
let
|
||||
cfg = config.samfelag.modules.system.utils;
|
||||
in
|
||||
{
|
||||
options.samfelag.modules.system.utils = {
|
||||
enable = lib.mkEnableOption "utils";
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
bc
|
||||
zip
|
||||
unzip
|
||||
];
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user