Compare commits
3 Commits
2347adc56f
...
4577adc53f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4577adc53f | ||
|
|
5f41530745 | ||
|
|
733246b059 |
@@ -32,12 +32,17 @@ padding-left = 0
|
||||
padding-right = 0
|
||||
module-margin-left = 0
|
||||
|
||||
separator = |
|
||||
separator-padding = .5
|
||||
separator-foreground = ${colours.trans}
|
||||
separator-background = ${colours.trans}
|
||||
|
||||
[bar/bottom]
|
||||
inherit = bar/base
|
||||
bottom = true
|
||||
|
||||
modules-left = workspaces
|
||||
modules-right = volume paddinglite battery
|
||||
modules-right = wireless bluetooth volume battery
|
||||
|
||||
tray-position = center
|
||||
tray-maxsize = 28
|
||||
@@ -46,6 +51,6 @@ tray-maxsize = 28
|
||||
inherit = bar/base
|
||||
bottom = false
|
||||
|
||||
modules-left =
|
||||
modules-left = spotify
|
||||
modules-center = date
|
||||
modules-right = i3-mode
|
||||
|
||||
@@ -28,6 +28,12 @@ orange- = #FEB548
|
||||
orange = #F18F01
|
||||
orange+ = #A26201
|
||||
|
||||
apricot = #FFCAB1
|
||||
|
||||
rose- = #CC8FA0
|
||||
rose = #AB4E68
|
||||
rose+ = #7E3A4D
|
||||
|
||||
[colours/date]
|
||||
bg = ${colours.pear}
|
||||
fg = ${colours.gray}
|
||||
@@ -55,7 +61,23 @@ bg = ${colours.orange}
|
||||
fg = ${colours.gray}
|
||||
|
||||
[colours/volume]
|
||||
volume-bg = ${colours.blue}
|
||||
volume-bg = ${colours.rose}
|
||||
volume-fg = ${colours.white}
|
||||
muted-bg = ${colours.blue-}
|
||||
muted-bg = ${colours.rose-}
|
||||
muted-fg = ${colours.white}
|
||||
|
||||
[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}
|
||||
|
||||
[colours/bluetooth]
|
||||
bg = ${colours.blue}
|
||||
fg = ${colours.white}
|
||||
|
||||
[colours/spotify]
|
||||
bg = ${colours.green}
|
||||
fg = ${colours.gray}
|
||||
|
||||
9
config/.config/polybar/bars/modules/bluetooth.ini
Normal file
9
config/.config/polybar/bars/modules/bluetooth.ini
Normal file
@@ -0,0 +1,9 @@
|
||||
[module/bluetooth]
|
||||
type = custom/script
|
||||
exec = ~/.config/polybar/scripts/bluetooth.sh
|
||||
interval = 5
|
||||
click-left = ~/.config/polybar/scripts/bluetooth.sh --toggle &
|
||||
|
||||
format-background = ${colours/bluetooth.bg}
|
||||
format-foreground = ${colours/bluetooth.fg}
|
||||
format-padding = 1
|
||||
@@ -1,13 +0,0 @@
|
||||
[module/padding]
|
||||
type = custom/text
|
||||
content = ||
|
||||
content-padding = 1
|
||||
content-foreground = ${colours.trans}
|
||||
content-background = ${colours.trans}
|
||||
|
||||
[module/paddinglite]
|
||||
type = custom/text
|
||||
content = |
|
||||
content-padding = .5
|
||||
content-foreground = ${colours.trans}
|
||||
content-background = ${colours.trans}
|
||||
8
config/.config/polybar/bars/modules/spotify.ini
Normal file
8
config/.config/polybar/bars/modules/spotify.ini
Normal file
@@ -0,0 +1,8 @@
|
||||
[module/spotify]
|
||||
type = custom/script
|
||||
exec = ~/.config/polybar/scripts/spotify.sh
|
||||
interval = 5
|
||||
|
||||
format-background = ${colours/spotify.bg}
|
||||
format-foreground = ${colours/spotify.fg}
|
||||
format-padding = 1
|
||||
28
config/.config/polybar/bars/modules/wireless.ini
Normal file
28
config/.config/polybar/bars/modules/wireless.ini
Normal file
@@ -0,0 +1,28 @@
|
||||
[module/wireless]
|
||||
type = internal/network
|
||||
interface-type = wireless
|
||||
interval = 3.0
|
||||
|
||||
accumulate-stats = true
|
||||
;unknown-as-up = true
|
||||
|
||||
; The unit used for displaying network speeds
|
||||
; For example if set to the empty string, a speed of 5 KB/s is displayed as 5 K
|
||||
speed-unit = ''
|
||||
|
||||
format-connected = <label-connected>
|
||||
label-connected = %{T2}直%{T-} %essid% (%local_ip%)
|
||||
label-connected-background = ${colours/wireless.connected-bg}
|
||||
label-connected-foreground = ${colours/wireless.connected-fg}
|
||||
label-connected-padding = 1
|
||||
|
||||
format-disconnected = <label-disconnected>
|
||||
label-disconnected = %{T2}睊
|
||||
label-disconnected-background = ${colours/wireless.disconnected-bg}
|
||||
label-disconnected-foreground = ${colours/wireless.disconnected-fg}
|
||||
label-disconnected-padding = 1
|
||||
|
||||
format-packetloss = <label-connected>*
|
||||
label-packetloss-background = ${colours/wireless.packetloss-bg}
|
||||
label-packetloss-foreground = ${colours/wireless.packetloss-fg}
|
||||
label-packetloss-padding = 1
|
||||
58
config/.config/polybar/scripts/bluetooth.sh
Executable file
58
config/.config/polybar/scripts/bluetooth.sh
Executable file
@@ -0,0 +1,58 @@
|
||||
#!/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
|
||||
20
config/.config/polybar/scripts/spotify.sh
Executable file
20
config/.config/polybar/scripts/spotify.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
|
||||
main() {
|
||||
pgrep spotify -l | grep -v spotify.sh > /dev/null || return
|
||||
|
||||
cmd="org.freedesktop.DBus.Properties.Get"
|
||||
domain="org.mpris.MediaPlayer2"
|
||||
path="/org/mpris/MediaPlayer2"
|
||||
|
||||
meta=$(dbus-send --print-reply --dest=${domain}.spotify /org/mpris/MediaPlayer2 ${cmd} string:${domain}.Player string:Metadata)
|
||||
|
||||
# Normal track
|
||||
artist=$(echo "$meta" | sed -nr '/xesam:artist"/,+2s/^ +string "(.*)"$/\1/p' | tail -1 | sed 's/\&/\\&/g' | sed 's#\/#\\/#g')
|
||||
album=$(echo "$meta" | sed -nr '/xesam:album"/,+2s/^ +variant +string "(.*)"$/\1/p' | tail -1| sed 's/\&/\\&/g'| sed 's#\/#\\/#g')
|
||||
title=$(echo "$meta" | sed -nr '/xesam:title"/,+2s/^ +variant +string "(.*)"$/\1/p' | tail -1 | sed 's/\&/\\&/g'| sed 's#\/#\\/#g')
|
||||
|
||||
echo "阮 ${*:-%artist% - %title%}" | sed "s/%artist%/$artist/g;s/%title%/$title/g;s/%album%/$album/g"i | sed "s/\&/\&/g" | sed "s#\/#\/#g"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -18,6 +18,7 @@
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
config.allowUnfree = true;
|
||||
overlays = import ./overlays;
|
||||
};
|
||||
lib = nixpkgs.lib;
|
||||
in {
|
||||
@@ -26,6 +27,7 @@
|
||||
# - Kopavogur ----------------------------
|
||||
kopavogur = lib.nixosSystem {
|
||||
inherit system;
|
||||
inherit pkgs;
|
||||
modules = [
|
||||
|
||||
./system/modules
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
samfelag = {
|
||||
modules = {
|
||||
app = {
|
||||
discord.enable = true;
|
||||
spotify.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
{
|
||||
imports = [
|
||||
./alacritty.nix
|
||||
./discord.nix
|
||||
./spotify.nix
|
||||
];
|
||||
}
|
||||
|
||||
17
home/modules/app/discord.nix
Normal file
17
home/modules/app/discord.nix
Normal file
@@ -0,0 +1,17 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.samfelag.modules.app.discord;
|
||||
in
|
||||
{
|
||||
options.samfelag.modules.app.discord = {
|
||||
enable = mkEnableOption "discord";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
discord
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -52,7 +52,6 @@ in {
|
||||
|
||||
xsession.windowManager.i3 = {
|
||||
enable = true;
|
||||
package = pkgs.i3-gaps;
|
||||
|
||||
config = {
|
||||
modifier = mod;
|
||||
|
||||
@@ -26,6 +26,7 @@ in {
|
||||
|
||||
xdg.configFile."polybar/config.ini".source = ../../../config/.config/polybar/config.ini;
|
||||
xdg.configFile."polybar/bars".source = ../../../config/.config/polybar/bars;
|
||||
xdg.configFile."polybar/scripts".source = ../../../config/.config/polybar/scripts;
|
||||
|
||||
systemd.user.services.polybar = {
|
||||
Unit = {
|
||||
@@ -36,7 +37,7 @@ in {
|
||||
|
||||
Service = {
|
||||
Type = "forking";
|
||||
Environment = "PATH=${polybar_pkg}/bin:/run/wrappers/bin";
|
||||
PassEnvironment = "PATH";
|
||||
ExecStart =
|
||||
let scriptPkg = pkgs.writeShellScriptBin "polybar-start" script;
|
||||
in "${scriptPkg}/bin/polybar-start";
|
||||
|
||||
3
overlays/default.nix
Normal file
3
overlays/default.nix
Normal file
@@ -0,0 +1,3 @@
|
||||
[
|
||||
(import ./discord.nix)
|
||||
]
|
||||
6
overlays/discord.nix
Normal file
6
overlays/discord.nix
Normal file
@@ -0,0 +1,6 @@
|
||||
self: super:
|
||||
{
|
||||
discord = super.discord.overrideAttrs (_: {
|
||||
src = builtins.fetchTarball https://discord.com/api/download?platform=linux&format=tar.gz;
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user