back to i3

This commit is contained in:
Ben Kyd
2023-05-16 13:01:48 +01:00
parent a687895725
commit 1ce87eae90
80 changed files with 4006 additions and 729 deletions

3
.gitmodules vendored
View File

@@ -16,3 +16,6 @@
[submodule "common/.config/awesome/plugins/nice"]
path = common/.config/awesome/plugins/nice
url = https://github.com/AlphaKeks/awesome-wm-nice
[submodule "common/.config/awesome/plugins/udisks2"]
path = common/.config/awesome/plugins/udisks2
url = https://github.com/mireq/awesome-udisks2-mount

View File

@@ -1,6 +1,9 @@
# Dotfiles
## Ben's Amazing Dotfile Installer
NOTE THIS ONLY WORKS IF THE USERNAME IS benk
The only prerequisite for Ben's Amazing Dotfile Installer is to install nodejs
`node bootstrap.js [--os[-o] ubuntu/arch] [--host[-h] host/laptop]`

View File

@@ -5,8 +5,8 @@ yay -S neovim-git nvm wezterm ranger ripgrep zsh zsh-vi-mode curl exa
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# WM Deps
yay -S awesome-git
yay -S picom-pijulis-git
yay -S awesome-git i3 ttf-material-design-icons ttf-unifont polybar
yay -S picom-ftlabs-git
yay -S i3exit arc-icon-theme ttf-twemoji xorg-xbacklight xidlehook sysstat i3blocks mpris-ctl flameshot perl rofi
mkdir -p ~/.local/share/fonts

View File

@@ -267,6 +267,7 @@ awful.keyboard.append_global_keybindings({
client.focus:move_to_tag(tag)
end
end),
awful.key({}, "XF86MonBrightnessUp",
function()
awful.spawn("brightnessctl s +5%", false)

View File

@@ -43,36 +43,5 @@ require("ben.autostart")
require("ben.volume")
require("ben.backlight")
-- bling
local bling = require("plugins.bling")
-- fancy titlebars
local nice = require("plugins.nice")
nice({
titlebar_color = Ben.colors.crust,
titlebar_height = 20,
titlebar_font = Ben.fonts.small,
button_size = 14,
mb_resize = nice.MB_MIDDLE,
titlebar_radius = 0,
mb_contextmenu = nice.MB_RIGHT,
titlebar_items = {
left = {},
middle = "title",
right = { "maximize", "close" },
},
maximize_color = Ben.colors.green,
close_color = Ben.colors.red,
})
-- fix annoying fullscreen stuff
client.connect_signal("property::fullscreen", function(c)
if c.fullscreen then
awful.titlebar.hide(c)
c.border_width = 0 --c.fullscreen and 0 or beautiful.border_width
c:geometry(c.screen.geometry)
else
awful.titlebar.show(c)
end
end)

View File

@@ -0,0 +1 @@

253
common/.config/i3/config Normal file
View File

@@ -0,0 +1,253 @@
# i3 config file (v4)
set $rosewater #f4dbd6
set $flamingo #f0c6c6
set $pink #f5bde6
set $mauve #c6a0f6
set $red #ed8796
set $maroon #ee99a0
set $peach #f5a97f
set $green #a6da95
set $teal #8bd5ca
set $sky #91d7e3
set $sapphire #7dc4e4
set $blue #8aadf4
set $lavender #b7bdf8
set $text #cad3f5
set $subtext1 #b8c0e0
set $subtext0 #a5adcb
set $overlay2 #939ab7
set $overlay1 #8087a2
set $overlay0 #6e738d
set $surface2 #5b6078
set $surface1 #494d64
set $surface0 #363a4f
set $base #24273a
set $mantle #1e2030
set $crust #181926
# Theme colors
client.focused $pink $pink $base $blue $blue
client.focused_inactive $pink $pink $base $blue $blue
client.unfocused $base $surface0 $overlay2 $surface0 $surface0
client.urgent $red $red $base $red $red
client.placeholder $overlay0 $base $text $overlay0 $overlay0
client.background $base
# Set mod key (Mod1=<Alt>, Mod4=<Super>)
set $mod Mod4
floating_modifier $mod
default_border none
default_floating_border normal
exec_always --no-startup-id $HOME/.config/i3/i3-chrome-tab-dragging.py
# remember to install this on the aur!
exec --no-startup-id alternating_layouts.py
font xft:DejaVu Sans Mono 12
bindsym $mod+Return exec wezterm
bindsym $mod+Shift+q kill
bindsym $mod+d exec --no-startup-id rofi -show drun
bindsym $mod+z exec --no-startup-id morc_menu
bindsym $mod+Print --release exec --no-startup-id i3-scrot -w
bindsym $mod+Ctrl+x --release exec --no-startup-id xkill
bindsym Print exec flameshot gui
# Screen brightness controls
bindsym XF86MonBrightnessUp exec "brightnessctl set +5%; notify-send 'brightness up'"
bindsym XF86MonBrightnessDown exec "brightnessctl set 5-%; notify-send 'brightness down'"
# Audio Controls
bindsym XF86AudioPlay exec "mpris-ctl pp && mpris-ctl --player inactive pp"
bindsym XF86AudioNext exec "mpris-ctl --player active next"
bindsym XF86AudioPrev exec "mpris-ctl --player active prev"
#bindsym XF86AudioPlay exec "playerctl play-pause"
#bindsym XF86AudioNext exec "playerctl next"
#bindsym XF86AudioPrev exec "playerctl previous"
focus_follows_mouse yes
# workspace back and forth (with/without active container)
workspace_auto_back_and_forth yes
bindsym $mod+b workspace back_and_forth
bindsym $mod+Shift+b move container to workspace back_and_forth; workspace back_and_forth
bindsym $mod+q split toggle
bindsym $mod+f fullscreen toggle
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
bindsym $mod+Shift+space floating toggle
bindsym $mod+space focus mode_toggle
bindsym $mod+Shift+s sticky toggle
bindsym $mod+a focus parent
# scratchpad (todo learn what this is)
bindsym $mod+Shift+minus move scratchpad
bindsym $mod+minus scratchpad show
# Workspace names
set $ws1 1
set $ws2 2
set $ws3 3
set $ws4 4
set $ws5 5
set $ws6 6
set $ws7 7
set $ws8 8
set $ws9 9
# switch to workspace
bindsym $mod+1 workspace $ws1
bindsym $mod+2 workspace $ws2
bindsym $mod+3 workspace $ws3
bindsym $mod+4 workspace $ws4
bindsym $mod+5 workspace $ws5
bindsym $mod+6 workspace $ws6
bindsym $mod+7 workspace $ws7
bindsym $mod+8 workspace $ws8
bindsym $mod+9 workspace $ws9
# Move focused container to workspace
bindsym $mod+Ctrl+1 move container to workspace $ws1
bindsym $mod+Ctrl+2 move container to workspace $ws2
bindsym $mod+Ctrl+3 move container to workspace $ws3
bindsym $mod+Ctrl+4 move container to workspace $ws4
bindsym $mod+Ctrl+5 move container to workspace $ws5
bindsym $mod+Ctrl+6 move container to workspace $ws6
bindsym $mod+Ctrl+7 move container to workspace $ws7
bindsym $mod+Ctrl+8 move container to workspace $ws8
bindsym $mod+Ctrl+9 move container to workspace $ws9
# Move to workspace with focused container
bindsym $mod+Shift+1 move container to workspace $ws1; workspace $ws1
bindsym $mod+Shift+2 move container to workspace $ws2; workspace $ws2
bindsym $mod+Shift+3 move container to workspace $ws3; workspace $ws3
bindsym $mod+Shift+4 move container to workspace $ws4; workspace $ws4
bindsym $mod+Shift+5 move container to workspace $ws5; workspace $ws5
bindsym $mod+Shift+6 move container to workspace $ws6; workspace $ws6
bindsym $mod+Shift+7 move container to workspace $ws7; workspace $ws7
bindsym $mod+Shift+8 move container to workspace $ws8; workspace $ws8
bindsym $mod+Shift+9 move container to workspace $ws9; workspace $ws9
# resize focused window
bindsym $mod+Shift+h resize shrink width 5 px or 5 pp9t
bindsym $mod+Shift+j resize grow height 5 px or 5 ppt
bindsym $mod+Shift+k resize shrink height 5 px or 5 ppt
bindsym $mod+Shift+l resize grow width 5 px or 5 ppt
# focus
bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l focus right
# move focused window
bindsym $mod+Ctrl+h move left
bindsym $mod+Ctrl+j move down
bindsym $mod+Ctrl+k move up
bindsym $mod+Ctrl+l move right
# move workspace amongst screens
bindsym $mod+Ctrl+Shift+h move workspace to output left
bindsym $mod+Ctrl+Shift+l move workspace to output right
bindsym $mod+Ctrl+Shift+k move workspace to output up
bindsym $mod+Ctrl+Shift+j move workspace to output down
# Open applications on specific workspaces
assign [class="discord"] $ws4
# Open specific applications in floating mode
for_window [title="alsamixer"] floating enable border pixel 1
for_window [class="Clipgrab"] floating enable
for_window [class="Galculator"] floating enable border pixel 1
for_window [class="GParted"] floating enable border normal
for_window [class="Lxappearance"] floating enable sticky enable border normal
for_window [class="Nitrogen"] floating enable sticky enable border normal
for_window [class="Pavucontrol"] floating enable
for_window [class="qt5ct"] floating enable sticky enable border normal
for_window [class="Qtconfig-qt4"] floating enable sticky enable border normal
for_window [class="Aeon"] floating enable, sticky enable
for_window [class="Inferno v3.0.1_alpha"] floating enable, sticky enable
# switch to workspace with urgent window automatically
for_window [urgent=latest] focus
# reload the config file
bindsym $mod+Shift+c reload
bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session)
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"
# Set shut down, restart and locking features
bindsym $mod+0 mode "$mode_system"
set $mode_system (l)ock, (e)xit, switch_(u)ser, (s)uspend, (h)ibernate, (r)eboot, (Shift+s)hutdown
mode "$mode_system" {
bindsym l exec --no-startup-id i3exit lock, mode "default"
bindsym s exec --no-startup-id i3exit suspend, mode "default"
bindsym u exec --no-startup-id i3exit switch_user, mode "default"
bindsym e exec --no-startup-id i3exit logout, mode "default"
bindsym h exec --no-startup-id i3exit hibernate, mode "default"
bindsym r exec --no-startup-id i3exit reboot, mode "default"
bindsym Shift+s exec --no-startup-id i3exit shutdown, mode "default"
# exit system mode: "Enter" or "Escape"
bindsym Return mode "default"
bindsym Escape mode "default"
}
# Autostart applications
exec --no-startup-id nitrogen --restore
exec --no-startup-id nm-applet
exec --no-startup-id xfce4-power-manager
exec --no-startup-id clipit
exec --no-startup-id xidlehook --not-when-fullscreen --not-when-audio --timer 600 'blurlock' ''
exec_always --no-startup-id ff-theme-util
exec_always --no-startup-id fix_xcursor
exec --no-startup-id volumeicon
exec --no-startup-id mpris-proxy
exec --no-startup-id pa-applet
exec_always killall -q picom ; picom -b --config $HOME/.config/picom.conf
# hide/unhide i3status bar
bindsym $mod+m bar mode toggle
gaps inner 10
gaps outer -1
smart_gaps on
smart_borders on
# Hide title bar
default_border pixel 0
default_floating_border pixel 0
for_window [class="^.*"] border pixel 0
# Enable and disable gaps
bindsym $mod+Shift+n gaps inner all set 0; gaps outer all set 0
bindsym $mod+n gaps inner all set 7; gaps outer all set -1
bar {
status_command SCRIPT_DIR=~/.config/i3blocks/scripts i3blocks -c ~/.config/i3blocks/config
position bottom
separator_symbol "│"
tray_output primary
tray_padding 4
font pango:DejaVu Sans Mono Nerd Font 12
colors {
background $base
statusline $text
separator $rosewater
# border bg text
focused_workspace $pink $pink $base
inactive_workspace $surface0 $surface0 $overlay0
urgent_workspace $red $red $base
}
}

View File

@@ -1,24 +1,63 @@
[NOW_PLAYING]
command=mpris-ctl info '🎶 %player_name: %track_name - %artist_name'
separator_block_width=18
[title]
command=$SCRIPT_DIR/i3-focusedwindow/i3-focusedwindow
interval=1
color=#1DB954
separator=false
[DISK]
command=df -h / | awk '/\//{ printf(" 💾 %sB \n", $4) }'
interval=10
color=#C9E3DB
[CPU]
full_text= CPU: 0.00% @ +00.0°C
command=~/.config/i3blocks/cpu/cpu_info.sh
interval=2
color=#0071C5
[MEM]
command=free -h | awk '/Mem:/ { printf(" %5s/%s \n", $3, $2) }'
[spotify]
label=
command=python3 $SCRIPT_DIR/spotify/spotify.py
seperator=false
interval=5
color=#FEC925
color=#c6a0f6
[TIME_DATE]
[memory]
label=󰍛
command=$SCRIPT_DIR/memory/memory
interval=30
color=#f4dbd6
[cpu_usage]
label=
command=$SCRIPT_DIR/cpu_usage/cpu_usage
interval=10
#color=#8bd5ca
#T_WARN=50
#T_CRIT=80
#DECIMALS=2
#COLOR_NORMAL=#EBDBB2
#COLOR_WARN=#FFFC00
#COLOR_CRIT=#FF0000
[jas]
label=󰃟
command=$SCRIPT_DIR/jas/jas
markup="pango"
interval=once
signal=10
#STEP_SIZE=5
color=#eed49f
[baterkos]
label=
command=$SCRIPT_DIR/battery/battery
interval=10
color=#b7bdf8
[volume]
label=󰕾
command=$SCRIPT_DIR/volume/volume
#label=VOL
interval=5
signal=10
markup=pango
color=#f5bde6
[time]
label=
command=date +" %a, %d %b - %H:%M:%S"
min_width=100
align=center
seperator=false
interval=1

View File

@@ -0,0 +1,20 @@
# battery
Show battery info.
![](battery.png)
# Dependencies
* `acpi`
# Config
```
[battery]
command=$SCRIPT_DIR/battery
interval=30
LABEL=BAT
#LABEL=⚡
#BAT_NUMBER=0
```

View File

@@ -0,0 +1,94 @@
#!/usr/bin/env perl
#
# Copyright 2014 Pierre Mavro <deimos@deimos.fr>
# Copyright 2014 Vivien Didelot <vivien@didelot.org>
#
# Licensed under the terms of the GNU GPL v3, or any later version.
#
# This script is meant to use with i3blocks. It parses the output of the "acpi"
# command (often provided by a package of the same name) to read the status of
# the battery, and eventually its remaining time (to full charge or discharge).
#
# The color will gradually change for a percentage below 85%, and the urgency
# (exit code 33) is set if there is less that 5% remaining.
use strict;
use warnings;
use utf8;
my $acpi;
my $status;
my $percent;
my $ac_adapt;
my $full_text;
my $short_text;
my $bat_number = $ENV{BAT_NUMBER} || 0;
my $label = $ENV{LABEL} || "";
# read the first line of the "acpi" command output
open (ACPI, "acpi -b 2>/dev/null| grep 'Battery $bat_number' |") or die;
$acpi = <ACPI>;
close(ACPI);
# fail on unexpected output
if (not defined($acpi)) {
# don't print anything to stderr if there is no battery
exit(0);
}
elsif ($acpi !~ /: ([\w\s]+), (\d+)%/) {
die "$acpi\n";
}
$status = $1;
$percent = $2;
$full_text = "$label$percent%";
if ($status eq 'Discharging') {
$full_text .= ' 󱐋';
} elsif ($status eq 'Charging') {
$full_text .= ' ';
} elsif ($status eq 'Unknown') {
open (AC_ADAPTER, "acpi -a |") or die;
$ac_adapt = <AC_ADAPTER>;
close(AC_ADAPTER);
if ($ac_adapt =~ /: ([\w-]+)/) {
$ac_adapt = $1;
if ($ac_adapt eq 'on-line') {
$full_text .= ' 󱐋';
} elsif ($ac_adapt eq 'off-line') {
$full_text .= ' ';
}
}
}
$short_text = $full_text;
if ($acpi =~ /(\d\d:\d\d):/) {
$full_text .= " ($1)";
}
# print text
print "$full_text\n";
print "$short_text\n";
# consider color and urgent flag only on discharge
if ($status eq 'Discharging') {
if ($percent < 20) {
print "#ed8796\n";
} elsif ($percent < 40) {
print "#ee99a0\n";
} elsif ($percent < 60) {
print "#f5a97f\n";
} elsif ($percent < 85) {
print "#a6da958\n";
}
if ($percent < 5) {
exit(33);
}
}
exit(0);

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -0,0 +1,6 @@
[battery]
command=$SCRIPT_DIR/battery
interval=30
LABEL=BAT
#LABEL=⚡
#BAT_NUMBER=0

View File

@@ -0,0 +1,25 @@
# cpu_usage
Show CPU usage.
![](cpu_usage.png)
# Dependencies
* `mpstat`
# Config
```
[cpu_usage]
command=$SCRIPT_DIR/cpu_usage
interval=10
LABEL=CPU
#min_width=CPU: 100.00%
#T_WARN=50
#T_CRIT=80
#DECIMALS=2
#COLOR_NORMAL=#EBDBB2
#COLOR_WARN=#FFFC00
#COLOR_CRIT=#FF0000
```

View File

@@ -0,0 +1,66 @@
#!/usr/bin/env perl
#
# Copyright 2014 Pierre Mavro <deimos@deimos.fr>
# Copyright 2014 Vivien Didelot <vivien@didelot.org>
# Copyright 2014 Andreas Guldstrand <andreas.guldstrand@gmail.com>
#
# Licensed under the terms of the GNU GPL v3, or any later version.
use strict;
use warnings;
use utf8;
use Getopt::Long;
# default values
my $t_warn = $ENV{T_WARN} // 50;
my $t_crit = $ENV{T_CRIT} // 80;
my $cpu_usage = -1;
my $decimals = $ENV{DECIMALS} // 2;
my $label = $ENV{LABEL} // "";
my $color_normal = $ENV{COLOR_NORMAL} // "#8bd5ca";
my $color_warn = $ENV{COLOR_WARN} // "#f5a97f";
my $color_crit = $ENV{COLOR_CRIT} // "#ed8796";
sub help {
print "Usage: cpu_usage [-w <warning>] [-c <critical>] [-d <decimals>]\n";
print "-w <percent>: warning threshold to become yellow\n";
print "-c <percent>: critical threshold to become red\n";
print "-d <decimals>: Use <decimals> decimals for percentage (default is $decimals) \n";
exit 0;
}
GetOptions("help|h" => \&help,
"w=i" => \$t_warn,
"c=i" => \$t_crit,
"d=i" => \$decimals,
);
# Get CPU usage
$ENV{LC_ALL}="en_US"; # if mpstat is not run under en_US locale, things may break, so make sure it is
open (MPSTAT, 'mpstat 1 1 |') or die;
while (<MPSTAT>) {
if (/^.*\s+(\d+\.\d+)[\s\x00]?$/) {
$cpu_usage = 100 - $1; # 100% - %idle
last;
}
}
close(MPSTAT);
$cpu_usage eq -1 and die 'Can\'t find CPU information';
# Print short_text, full_text
print "${label}";
printf "%.${decimals}f%%\n", $cpu_usage;
print "${label}";
printf "%.${decimals}f%%\n", $cpu_usage;
# Print color, if needed
if ($cpu_usage >= $t_crit) {
print "${color_crit}\n";
} elsif ($cpu_usage >= $t_warn) {
print "${color_warn}\n";
} else {
print "${color_normal}\n";
}
exit 0;

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,11 @@
[cpu_usage]
command=$SCRIPT_DIR/cpu_usage
interval=10
LABEL=CPU
#min_width=CPU: 100.00%
#T_WARN=50
#T_CRIT=80
#DECIMALS=2
#COLOR_NORMAL=#EBDBB2
#COLOR_WARN=#FFFC00
#COLOR_CRIT=#FF0000

View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 Jessey White-Cinis
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,32 @@
# dunst
Creates a do-not-disturb button for muting [dunst](https://dunst-project.org/) notifications.
![](dunst.gif)
# Dependencies
- [dunst](https://dunst-project.org/)
- [Font Awesome](https://fontawesome.com) for the [bell](https://fontawesome.com/icons/bell?style=solid) and [bell-slash](https://fontawesome.com/icons/bell-slash?style=solid) icons
# Usage
Clicking the bell icon will toggle dunst notifications from being displayed.
This is accomplished using the `dunstctl` command.
# Config
```INI
[dunst]
command=$SCRIPT_DIR/dunst
interval=once
format=json
markup=pango
#min_width=50
#align=center
```

View File

@@ -0,0 +1,40 @@
#!/usr/bin/env python3
"""
A do-not-disturb button for muting Dunst notifications in i3 using i3blocks
Mute is handled using the `dunstctl` command.
"""
__author__ = "Jessey White-Cinis <j@cin.is>"
__copyright__ = "Copyright (c) 2019 Jessey White-Cinis"
__license__ = "MIT"
__version__ = "1.1.0"
import os
import subprocess as sp
import json
def mute_toggle():
'''Toggle dunst notifications'''
sp.run(["dunstctl", "set-paused", "toggle"], check=True)
def clicked():
'''Returns True if the button was clicked'''
button = os.environ.get("BLOCK_BUTTON", None)
return bool(button)
def muted():
'''Returns True if Dunst is muted'''
output = sp.check_output(('dunstctl', 'is-paused'))
return u'true' == output.strip().decode("UTF-8")
if clicked():
# toggle button click to turn mute on and off
mute_toggle()
if muted():
RTN = {"full_text":"<span font='Font Awesome 5 Free Solid' color='#BE616E'>\uf1f6</span>"}
else:
RTN = {"full_text":"<span font='Font Awesome 5 Free Solid' color='#A4B98E'>\uf0f3</span>"}
print(json.dumps(RTN))

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -0,0 +1,9 @@
[dunst]
command=$SCRIPT_DIR/dunst
markup=pango
interval=once
format=json
#min_width=50
#align=center
#DUNST_MUTE=off

View File

@@ -0,0 +1,28 @@
# i3 Focused window
Displays title of focused window in i3Wm
![Demo](i3-focusedwindow.png)
# Requirements
Dependencies: `xprop`, `awk`
# Command line arguments
```bash
i3-focusedwindow [maximum length to display]
```
Blank for unlimited length, i.e. output line can occupy all available space.
# Installation
The recommended i3blocks config is
```INI
[i3-focusedwindow]
label=[]=
command=$SCRIPT_DIR/i3-focusedwindow 20
interval=persist
```

View File

@@ -0,0 +1,15 @@
#!/usr/bin/env bash
# Author: Kn
while :
do
ID=$(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}')
if [[ $1 ]]
then
TITLE=$(xprop -id $ID -len $1 | awk '/_NET_WM_NAME/{$1=$2="";print}' | cut -d'"' -f2)
echo "$TITLE"
else
TITLE=$(xprop -id $ID | awk '/_NET_WM_NAME/{$1=$2="";print}' | cut -d'"' -f2)
echo "$TITLE"
fi
done

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@@ -0,0 +1,61 @@
#!/bin/bash
# FROM https://github.com/nashamri/i3blocks/blob/master/brightness
# One of the following: xrandr, xbacklight, kernel
METHOD="xbacklight"
METHOD="brightnessctl"
# Left click
if [[ "${BLOCK_BUTTON}" -eq 1 ]]; then
brightnessctl s 10%+
# Right click
elif [[ "${BLOCK_BUTTON}" -eq 3 ]]; then
brightnessctl s 10%-
fi >/dev/null 2>&1
URGENT_VALUE=10
if [[ "${METHOD}" = "xrandr" ]]; then
device="${BLOCK_INSTANCE:-primary}"
xrandrOutput=$(xrandr --verbose)
if [[ "${device}" = "primary" ]]; then
device=$(echo "${xrandrOutput}" | grep 'primary' | head -n 1 | awk -F ' ' '{print $1}')
fi
curBrightness=$(echo "${xrandrOutput}" | grep "${device}" -A 5 | grep -i "Brightness" | awk -F ':' '{print $2}')
elif [[ "${METHOD}" = "kernel" ]]; then
device="${BLOCK_INSTANCE:-intel_backlight}"
maxBrightness=$(cat /sys/class/backlight/${device}/max_brightness)
curBrightness=$(cat /sys/class/backlight/${device}/brightness)
elif [[ "${METHOD}" = "xbacklight" ]]; then
curBrightness=$(xbacklight -get)
elif [[ "${METHOD}" = "brightnessctl" ]]; then
curBrightness=$(brightnessctl -m i|awk -F, '{print $4}')
curBrightness=${curBrightness%%%}
fi
if [[ "${curBrightness}" -le 0 ]]; then
brightnessctl s 10%
fi
if [[ "${METHOD}" = "xrandr" ]]; then
percent=$(echo "scale=0;${curBrightness} * 100" | bc -l)
elif [[ "${METHOD}" = "kernel" ]]; then
percent=$(echo "scale=0;${curBrightness} / ${maxBrightness} * 100" | bc -l)
elif [[ "${METHOD}" = "xbacklight" ]]; then
percent=$(echo "scale=0;${curBrightness}" | bc -l)
elif [[ "${METHOD}" = "brightnessctl" ]]; then
percent=${curBrightness}
fi
percent=${percent%.*}
echo "${percent}%"
echo "${percent}%"
echo ""
if [[ "${percent}" -le "${URGENT_VALUE}" ]]; then
exit 33
fi

View File

@@ -0,0 +1,36 @@
# mediaplayer
Generic media player status/controls.
![Example screenshot](mediaplayer.png)
This displays "ARTIST - SONG" if music is playing. By
left-clicking/right-clicking the displayed text, it will play the previous/next
song. Middle-clicking will pause/unpause the song.
Supported players are:
- spotify, vlc, audacious, xmms2, mplayer and others that
use MPRIS DBus Interface Specification
- mpd
- cmus
- rhythmbox
mpd is supported through mpc (music player client).
For MPRIS support you need to have the playerctl binary in your path.
See: https://github.com/acrisci/playerctl
If you leave the instance empty playerctl will try to find an
active MPRIS-compatible player on its own.
# Installation
Add the following to your i3blocks config:
``` ini
[mediaplayer]
command=$SCRIPT_DIR/mediaplayer
instance=spotify
interval=5
signal=10
```

View File

@@ -0,0 +1,159 @@
#!/usr/bin/env perl
# Copyright (C) 2014 Tony Crisci <tony@dubstepdish.com>
# Copyright (C) 2015 Thiago Perrotta <perrotta dot thiago at poli dot ufrj dot br>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# For all media players except mpd/cmus/rhythmbox, MPRIS support should be
# enabled and the playerctl binary should be in your path.
# See https://github.com/acrisci/playerctl
# Set instance=NAME in the i3blocks configuration to specify a music player
# (playerctl will attempt to connect to org.mpris.MediaPlayer2.[NAME] on your
# DBus session). If instance is empty, playerctl will connect to the first
# supported media player it finds.
use Time::HiRes qw(usleep);
use Env qw(BLOCK_INSTANCE);
use constant DELAY => 50; # Delay in ms to let network-based players (spotify) reflect new data.
use constant SPOTIFY_STR => 'spotify';
my @metadata = ();
my $player_arg = "";
if ($BLOCK_INSTANCE) {
$player_arg = "--player='$BLOCK_INSTANCE'";
}
sub buttons {
my $method = shift;
if($method eq 'mpd') {
if ($ENV{'BLOCK_BUTTON'} == 1) {
system("mpc prev &>/dev/null");
} elsif ($ENV{'BLOCK_BUTTON'} == 2) {
system("mpc toggle &>/dev/null");
} elsif ($ENV{'BLOCK_BUTTON'} == 3) {
system("mpc next &>/dev/null");
} elsif ($ENV{'BLOCK_BUTTON'} == 4) {
system("mpc volume +10 &>/dev/null");
} elsif ($ENV{'BLOCK_BUTTON'} == 5) {
system("mpc volume -10 &>/dev/null");
}
} elsif ($method eq 'cmus') {
if ($ENV{'BLOCK_BUTTON'} == 1) {
system("cmus-remote --prev");
} elsif ($ENV{'BLOCK_BUTTON'} == 2) {
system("cmus-remote --pause");
} elsif ($ENV{'BLOCK_BUTTON'} == 3) {
system("cmus-remote --next");
}
} elsif ($method eq 'playerctl') {
if ($ENV{'BLOCK_BUTTON'} == 1) {
system("playerctl $player_arg previous");
usleep(DELAY * 1000) if $BLOCK_INSTANCE eq SPOTIFY_STR;
} elsif ($ENV{'BLOCK_BUTTON'} == 2) {
system("playerctl $player_arg play-pause");
} elsif ($ENV{'BLOCK_BUTTON'} == 3) {
system("playerctl $player_arg next");
usleep(DELAY * 1000) if $BLOCK_INSTANCE eq SPOTIFY_STR;
} elsif ($ENV{'BLOCK_BUTTON'} == 4) {
system("playerctl $player_arg volume 0.01+");
} elsif ($ENV{'BLOCK_BUTTON'} == 5) {
system("playerctl $player_arg volume 0.01-");
}
} elsif ($method eq 'rhythmbox') {
if ($ENV{'BLOCK_BUTTON'} == 1) {
system("rhythmbox-client --previous");
} elsif ($ENV{'BLOCK_BUTTON'} == 2) {
system("rhythmbox-client --play-pause");
} elsif ($ENV{'BLOCK_BUTTON'} == 3) {
system("rhythmbox-client --next");
}
}
}
sub cmus {
my @cmus = split /^/, qx(cmus-remote -Q);
if ($? == 0) {
foreach my $line (@cmus) {
my @data = split /\s/, $line;
if (shift @data eq 'tag') {
my $key = shift @data;
my $value = join ' ', @data;
@metadata[0] = $value if $key eq 'artist';
@metadata[1] = $value if $key eq 'title';
}
}
if (@metadata) {
buttons('cmus');
# metadata found so we are done
print(join ' - ', @metadata);
print("\n");
exit 0;
}
}
}
sub mpd {
my $data = qx(mpc current);
if (not $data eq '') {
buttons("mpd");
print($data);
exit 0;
}
}
sub playerctl {
buttons('playerctl');
my $artist = qx(playerctl $player_arg metadata artist 2>/dev/null);
chomp $artist;
# exit status will be nonzero when playerctl cannot find your player
exit(0) if $? || $artist eq '(null)';
push(@metadata, $artist) if $artist;
my $title = qx(playerctl $player_arg metadata title);
exit(0) if $? || $title eq '(null)';
push(@metadata, $title) if $title;
print(join(" - ", @metadata)) if @metadata;
}
sub rhythmbox {
buttons('rhythmbox');
my $data = qx(rhythmbox-client --print-playing --no-start);
print($data);
}
if ($player_arg =~ /mpd/) {
mpd;
}
elsif ($player_arg =~ /cmus/) {
cmus;
}
elsif ($player_arg =~ /rhythmbox/) {
rhythmbox;
}
else {
playerctl;
}
print("\n");

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -0,0 +1,20 @@
# memory
Show memory usage. Accepts instance "mem" or "swap".
![](memory.png)
# Config
```
[memory]
command=$SCRIPT_DIR/memory
label=MEM
interval=30
#[memory]
#command=$SCRIPT_DIR/memory
#label=SWAP
#instance=swap
#interval=30
```

View File

@@ -0,0 +1,11 @@
[memory]
command=$SCRIPT_DIR/memory
label=MEM
interval=30
#[memory]
#command=$SCRIPT_DIR/memory
#label=SWAP
#instance=swap
#interval=30

View File

@@ -0,0 +1,73 @@
#!/usr/bin/env sh
# Copyright (C) 2014 Julien Bonjean <julien@bonjean.info>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
TYPE="${BLOCK_INSTANCE:-mem}"
PERCENT="${PERCENT:-true}"
awk -v type=$TYPE -v percent=$PERCENT '
/^MemTotal:/ {
mem_total=$2
}
/^MemFree:/ {
mem_free=$2
}
/^Buffers:/ {
mem_free+=$2
}
/^Cached:/ {
mem_free+=$2
}
/^SwapTotal:/ {
swap_total=$2
}
/^SwapFree:/ {
swap_free=$2
}
END {
if (type == "swap") {
free=swap_free/1024/1024
used=(swap_total-swap_free)/1024/1024
total=swap_total/1024/1024
} else {
free=mem_free/1024/1024
used=(mem_total-mem_free)/1024/1024
total=mem_total/1024/1024
}
pct=0
if (total > 0) {
pct=used/total*100
}
# full text
if (percent == "true" ) {
printf("%.1fG/%.1fG (%.f%%)\n", used, total, pct)
} else {
printf("%.1fG/%.1fG\n", used, total)
}
# short text
printf("%.f%%\n", pct)
# color
if (pct > 90) {
print("#FF0000")
} else if (pct > 80) {
print("#FFAE00")
} else if (pct > 70) {
print("#FFF600")
}
}
' /proc/meminfo

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -0,0 +1,34 @@
# rofi-calendar
Have a minimal calendar pop up in rofi when clicking the date blocklet (right click to show next month)
![](screenshot.png)
![](screenshot2.png)
# Dependencies
* rofi
* cal from util-linux package, supporting --color=always
# Installation
* Copy the script into your directory of choice, e.g. ~/.i3blocks/blocklets
* Give it execution permission (`chmod +x rofi-calendar`)
* Edit rofi launch options in the script to fit your needs
* Add the following blocklet to your i3blocks.conf:
```ini
[rofi-calendar]
command=$SCRIPT_DIR/rofi-calendar
interval=3600
#BAR_POSITION=bottom
#WEEK_START=monday
#DATEFTM=+%a %d %b %Y
#SHORTFMT=+%d/%m/%Y
#LABEL=
#FONT=Monospace 10
#LEFTCLICK_PREV_MONTH=false
#PREV_MONTH_TEXT=« previous month «
#NEXT_MONTH_TEXT=» next month »
#ROFI_CONFIG_FILE=/dev/null
```

View File

@@ -0,0 +1,143 @@
#! /usr/bin/env bash
###### Variables ######
DATEFTM="${DATEFTM:-+%a %d %b %Y}"
SHORTFMT="${SHORTFMT:-+%d/%m/%Y}"
LABEL="${LABEL:- }"
FONT="${FONT:-Monospace 10}"
LEFTCLICK_PREV_MONTH=${LEFTCLICK_PREV_MONTH:-false}
PREV_MONTH_TEXT="${PREV_MONTH_TEXT:-« previous month «}"
NEXT_MONTH_TEXT="${NEXT_MONTH_TEXT:-» next month »}"
ROFI_CONFIG_FILE="${ROFI_CONFIG_FILE:-/dev/null}"
BAR_POSITION="${BAR_POSITION:-bottom}"
WEEK_START="${WEEK_START:-monday}"
###### Variables ######
###### Functions ######
# get current date and set today header
get_current_date() {
year=$(date '+%Y')
month=$(date '+%m')
day=$(date '+%d')
}
# print the selected month
print_month() {
mnt=$1
yr=$2
cal --color=always --$WEEK_START $mnt $yr \
| sed -e 's/\x1b\[[7;]*m/\<b\>\<u\>/g' \
-e 's/\x1b\[[27;]*m/\<\/u\>\<\/b\>/g' \
-e '/^ *$/d' \
| tail -n +2
echo $PREV_MONTH_TEXT$'\n'$NEXT_MONTH_TEXT
}
# increment year and/or month appropriately based on month increment
increment_month() {
# pick increment and define/update delta
incr=$1
(( delta += incr ))
# for non-current month
if (( incr != 0 )); then
# add the increment
month=$(( 10#$month + incr ))
# normalize month and compute year
if (( month > 0 )); then
(( month -= 1 ))
(( year += month/12 ))
(( month %= 12 ))
(( month += 1 ))
else
(( year += month/12 - 1 ))
(( month %= 12 ))
(( month += 12 ))
fi
fi
# adjust header
if (( delta == 0 )); then
# today's month => show dd/mm/yyyy
header=$(date "$DATEFTM")
else
# not today's month => show mm/yyyy
header=$(cal $month $year | sed -n '1s/^ *\(.*[^ ]\) *$/\1/p')
fi
}
###### Functions ######
###### Main body ######
get_current_date
# handle the click
# variables:
# current_row: set means today row is highlighted
# current_row: not set means...
# bias_row == 0: `next month` row is highlighted
# bias_row == -1: `prev month` row is highlighted
# selected: contains the selected row (next or prev month)
# month_page: the month to be printed
case "$BLOCK_BUTTON" in
1)
if [[ $LEFTCLICK_PREV_MONTH == true ]]; then
increment_month -1
bias_row=-1
else
increment_month 0
current_row=
fi
;;
2)
increment_month 0
current_row=
;;
3)
increment_month +1
bias_row=0
;;
esac
# rofi pop up
case "$BLOCK_BUTTON" in
1|2|3)
# as long as prev/next is selected (and the first time also)
while [[ "${selected+xxx}" != "xxx" ]] || [[ $selected =~ ($PREV_MONTH_TEXT|$NEXT_MONTH_TEXT) ]]; do
IFS=
month_page=$(print_month $month $year)
if [[ "${current_row+xxx}" = "xxx" ]]; then
current_row=$(( $(echo $month_page | grep -n ${day#0} | head -n 1 | cut -d: -f1) - 1 ))
else
current_row=$(( $(echo $month_page | wc -l) - 1))
fi
# check bar position and adjust anchor accordingly
if [[ $BAR_POSITION = "top" ]]; then
anchor="northeast"
else
anchor="southeast"
fi
# open rofi and read the selected row
# (add the following option to rofi command with proper config file, if needed)
selected="$(echo $month_page \
| rofi \
-dmenu \
-markup-rows \
-font $FONT \
-m -3 \
-theme-str 'window {width: 10%; anchor: '"$anchor"'; location: northwest;}' \
-theme-str 'listview {lines: '"$(echo $month_page | wc -l)"' ;scrollbar: false;}' \
-theme $ROFI_CONFIG_FILE \
-selected-row $(( current_row + bias_row )) \
-p "$header")"
# select next/prev month if necessary and prepare row to be highlighted
[[ $selected =~ $PREV_MONTH_TEXT ]] && { increment_month -1; bias_row=-1; }
[[ $selected =~ $NEXT_MONTH_TEXT ]] && { increment_month +1; bias_row=0; }
# get ready for successive next/prev month hits
unset current_row
done
esac
# print blocklet text
echo $LABEL$(date "$DATEFTM")
echo $LABEL$(date "$SHORTFMT")
###### Main body ######

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -0,0 +1,661 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<https://www.gnu.org/licenses/>.

View File

@@ -0,0 +1,37 @@
# rofi-wttr
A minimal weather line with forecast pop up on click. Using [rofi](https://github.com/davatorium/rofi) for the pop up and [wttr.in](https://wttr.in/) as the weather interface.
![The statusbar weather](rofi-wttr-status-line.png)
The statusbar
![The weather forecast popup](rofi-wttr-detail.png)
The popup with the default rofi theme
## Depencencies
* [rofi](https://github.com/davatorium/rofi)
* curl
## Installation
* Copy the script into your directory of choice, e.g. ~/.i3blocks/blocklets
* Give it execution permission (`chmod +x rofi-wttr`)
* Optional: Customize your rofi theme via the `rofi-theme-selector` command
* Optional: Customize the rofi launch options in the script
* Optional: Customize the wttr curl arguments in the script
* Add the following blocklet to your i3blocks.conf:
```ini
[rofi-wttr]
command=$SCRIPT_DIR/rofi-wttr
interval=3600
#BAR_POSITION=top
#FONT=Monospace 10
#LABEL=🌡️
#LOCATION=Washington_DC
#ROFI_CONFIG_FILE=/dev/null
```
## Thanks
Modeled off of [rofi-calendar](https://github.com/vivien/i3blocks-contrib/tree/master/rofi-calendar) with thanks to its authors.

View File

@@ -0,0 +1,8 @@
[rofi-wttr]
command=$SCRIPT_DIR/rofi-wttr
interval=300
#BAR_POSITION=top
#FONT=Monospace 10
#LABEL=🌡️
#LOCATION=Washington_DC
#ROFI_CONFIG_FILE=/dev/null

View File

@@ -0,0 +1,75 @@
#! /usr/bin/env bash
###### Variables ######
LABEL="${LABEL:- }"
LOCATION="${LOCATION:- }"
FONT="${FONT:-Monospace 10}"
ROFI_CONFIG_FILE="${ROFI_CONFIG_FILE:-/dev/null}"
BAR_POSITION="${BAR_POSITION:-bottom}"
###### Variables ######
###### Functions ######
# print the full weather
# see https://github.com/chubin/wttr.in#usage for full configuration options
print_weather_report() {
if [[ $LOCATION != " " ]]; then
curl https://wttr.in/$LOCATION?T
else
curl https://wttr.in/?T
fi
}
# print the one line weather
# see https://github.com/chubin/wttr.in#one-line-output for formatting options
print_weather_line() {
if [[ $LOCATION != " " ]]; then
curl -s https://wttr.in/${LOCATION}?u\&format="%C+%c+%t+(%f)+%w" | tr -d \"
else
curl -s 'https://wttr.in/?u\&format="%C+%c+%t+(%f)+%w"' | tr -d \"
fi
}
###### Functions ######
###### Main body ######
# handle any click
# rofi pop up
case "$BLOCK_BUTTON" in
1|2|3)
IFS=
weather_report=$(print_weather_report)
# check bar position and adjust anchor accordingly
if [[ $BAR_POSITION = "top" ]]; then
anchor="northwest"
else
anchor="southwest"
fi
# open rofi
# (add the following option to rofi command with proper config file, if needed)
echo $weather_report \
| rofi \
-dmenu \
-markup-rows \
-font $FONT \
-m -3 \
-theme-str 'window {width: 53%; anchor: '"$anchor"'; location: northwest;}' \
-theme-str 'listview {lines: '"$(echo $weather_report | wc -l)"' ;scrollbar: false;}' \
-theme $ROFI_CONFIG_FILE \
-p "Detailed weather report"
esac
# print blocklet text
if [[ $LABEL != " " ]]; then
echo $LABEL$(print_weather_line)
else
echo $(print_weather_line)
fi
###### Main body ######

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@@ -0,0 +1,54 @@
# shutdown_menu
Use rofi or zenity to change the system's runstate thanks to systemd.
The script can be used to shutdown, reboot, logout, lock etc.
It is inspired from an example in [i3pystatus' Wiki][i3pystatus].
![](rofi.png)
![](zenity.png)
# Requirements
- `systemd`,
- `rofi` or `zenity`,
- shell with associative array support.
# Usage
```
[shutdown_menu]
full_text=Quit
# If you are using FontAwesome, we recommend the power-off icon:
# http://fontawesome.io/icon/power-off/
command=$SCRIPT_DIR/shutdown_menu
#FG_COLOR=#bbbbbb
#BG_COLOR=#111111
#HLFG_COLOR=#111111
#HLBG_COLOR=#bbbbbb
#BORDER_COLOR=#222222
#ROFI_TEXT=Menu:
#ROFI_OPTIONS=-width 11 -location 3 -hide-scrollbar -bw 2
#ZENITY_TITLE=Menu
#ZENITY_TEXT=Action:
#ZENITY_OPTIONS=--column= --hide-header
#ENABLE_CONFIRMATIONS=true (must be true or false)
#LAUNCHER=rofi (must be rofi or zenity)
#LOCKSCRIPT=i3lock --color=${BG_COLOR#"#"}
```
Since `rofi` and `zenity` have mouse support, this can be integrated in
i3blocks with a clickable block. It can also be used directly from i3, for
instance:
```
bindsym Control+Mod1+Delete exec $SCRIPTDIR/shutdown_menu
```
For the i3blocks label to use, we recommend FontAwesome's
[power-off][power-off] icon.
[i3pystatus]: https://github.com/enkore/i3pystatus/wiki/Shutdown-Menu
[power-off]: http://fontawesome.io/icon/power-off

View File

@@ -0,0 +1,18 @@
[shutdown_menu]
full_text=Quit
# If you are using FontAwesome, we recommend the power-off icon:
# http://fontawesome.io/icon/power-off/
command=$SCRIPT_DIR/shutdown_menu
#FG_COLOR=#bbbbbb
#BG_COLOR=#111111
#HLFG_COLOR=#111111
#HLBG_COLOR=#bbbbbb
#BORDER_COLOR=#222222
#ROFI_TEXT=Menu:
#ROFI_OPTIONS=-width 11 -location 3 -hide-scrollbar -bw 2
#ZENITY_TITLE=Menu
#ZENITY_TEXT=Action:
#ZENITY_OPTIONS=--column= --hide-header
#ENABLE_CONFIRMATIONS=true (must be true or false)
#LAUNCHER=rofi (must be rofi or zenity)
#LOCKSCRIPT=i3lock --color=${BG_COLOR#"#"}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@@ -0,0 +1,186 @@
#!/usr/bin/env bash
#
# Use rofi/zenity to change system runstate thanks to systemd.
#
# Note: this currently relies on associative array support in the shell.
#
# Inspired from i3pystatus wiki:
# https://github.com/enkore/i3pystatus/wiki/Shutdown-Menu
#
# Copyright 2015 Benjamin Chrétien <chretien at lirmm dot fr>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#######################################################################
# BEGIN CONFIG #
#######################################################################
# Use a custom lock script
#LOCKSCRIPT="i3lock-extra -m pixelize"
# Colors: FG (foreground), BG (background), HL (highlighted)
FG_COLOR="${FG_COLOR:-#bbbbbb}"
BG_COLOR="${BG_COLOR:-#111111}"
HLFG_COLOR="${HLFG_COLOR:-#111111}"
HLBG_COLOR="${HLBG_COLOR:-#bbbbbb}"
BORDER_COLOR="${BORDER_COLOR:-#222222}"
# Options not related to colors
ROFI_TEXT="${ROFI_TEXT:-Menu:}"
ROFI_OPTIONS=(${ROFI_OPTIONS:--theme-str 'window {width: 11%; border: 2;} listview {scrollbar: false;}' -location 3})
# Zenity options
ZENITY_TITLE="${ZENITY_TITLE:-Menu}"
ZENITY_TEXT="${ZENITY_TEXT:-Action:}"
ZENITY_OPTIONS=(${ZENITY_OPTIONS:---column= --hide-header})
#######################################################################
# END CONFIG #
#######################################################################
# Whether to ask for user's confirmation
enable_confirmation=${ENABLE_CONFIRMATIONS:-false}
# Preferred launcher if both are available
preferred_launcher="${LAUNCHER:-rofi}"
usage="$(basename "$0") [-h] [-c] [-p name] -- display a menu for shutdown, reboot, lock etc.
where:
-h show this help text
-c ask for user confirmation
-p preferred launcher (rofi or zenity)
This script depends on:
- systemd,
- i3,
- rofi or zenity."
# Check whether the user-defined launcher is valid
launcher_list=(rofi zenity)
function check_launcher() {
if [[ ! "${launcher_list[@]}" =~ (^|[[:space:]])"$1"($|[[:space:]]) ]]; then
echo "Supported launchers: ${launcher_list[*]}"
exit 1
else
# Get array with unique elements and preferred launcher first
# Note: uniq expects a sorted list, so we cannot use it
i=1
launcher_list=($(for l in "$1" "${launcher_list[@]}"; do printf "%i %s\n" "$i" "$l"; let i+=1; done \
| sort -uk2 | sort -nk1 | cut -d' ' -f2- | tr '\n' ' '))
fi
}
# Parse CLI arguments
while getopts "hcp:" option; do
case "${option}" in
h) echo "${usage}"
exit 0
;;
c) enable_confirmation=true
;;
p) preferred_launcher="${OPTARG}"
check_launcher "${preferred_launcher}"
;;
*) exit 1
;;
esac
done
check_launcher "${preferred_launcher}"
# Check whether a command exists
function command_exists() {
command -v "$1" &> /dev/null 2>&1
}
# systemctl required
if ! command_exists systemctl ; then
exit 1
fi
# menu defined as an associative array
typeset -A menu
# Menu with keys/commands
menu=(
[Shutdown]="systemctl poweroff"
[Reboot]="systemctl reboot"
[Hibernate]="systemctl hibernate"
[Suspend]="systemctl suspend"
[Halt]="systemctl halt"
[Lock]="${LOCKSCRIPT:-i3lock --color=${BG_COLOR#"#"}}"
[Logout]="i3-msg exit"
[Cancel]=""
)
menu_nrows=${#menu[@]}
# Menu entries that may trigger a confirmation message
menu_confirm="Shutdown Reboot Hibernate Suspend Halt Logout"
launcher_exe=""
launcher_options=""
rofi_colors=""
function prepare_launcher() {
if [[ "$1" == "rofi" ]]; then
rofi_colors=(-bc "${BORDER_COLOR}" -bg "${BG_COLOR}" -fg "${FG_COLOR}" \
-hlfg "${HLFG_COLOR}" -hlbg "${HLBG_COLOR}")
launcher_exe="rofi"
launcher_options=(-dmenu -i -lines "${menu_nrows}" -p "${ROFI_TEXT}" \
"${rofi_colors[@]}" "${ROFI_OPTIONS[@]}")
elif [[ "$1" == "zenity" ]]; then
launcher_exe="zenity"
launcher_options=(--list --title="${ZENITY_TITLE}" --text="${ZENITY_TEXT}" \
"${ZENITY_OPTIONS[@]}")
fi
}
for l in "${launcher_list[@]}"; do
if command_exists "${l}" ; then
prepare_launcher "${l}"
break
fi
done
# No launcher available
if [[ -z "${launcher_exe}" ]]; then
exit 1
fi
launcher=(${launcher_exe} "${launcher_options[@]}")
selection="$(printf '%s\n' "${!menu[@]}" | sort | "${launcher[@]}")"
function ask_confirmation() {
if [ "${launcher_exe}" == "rofi" ]; then
confirmed=$(echo -e "Yes\nNo" | rofi -dmenu -i -lines 2 -p "${selection}?" \
"${rofi_colors[@]}" "${ROFI_OPTIONS[@]}")
[ "${confirmed}" == "Yes" ] && confirmed=0
elif [ "${launcher_exe}" == "zenity" ]; then
zenity --question --text "Are you sure you want to ${selection,,}?"
confirmed=$?
fi
if [ "${confirmed}" == 0 ]; then
i3-msg -q "exec ${menu[${selection}]}"
fi
}
if [[ $? -eq 0 && ! -z ${selection} ]]; then
if [[ "${enable_confirmation}" = true && \
${menu_confirm} =~ (^|[[:space:]])"${selection}"($|[[:space:]]) ]]; then
ask_confirmation
else
i3-msg -q "exec ${menu[${selection}]}"
fi
fi

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@@ -0,0 +1,34 @@
#!/usr/bin/python
import dbus
import os
import sys
try:
bus = dbus.SessionBus()
spotify = bus.get_object("org.mpris.MediaPlayer2.spotify", "/org/mpris/MediaPlayer2")
if os.environ.get('BLOCK_BUTTON'):
control_iface = dbus.Interface(spotify, 'org.mpris.MediaPlayer2.Player')
if (os.environ['BLOCK_BUTTON'] == '1'):
control_iface.Previous()
elif (os.environ['BLOCK_BUTTON'] == '2'):
control_iface.PlayPause()
elif (os.environ['BLOCK_BUTTON'] == '3'):
control_iface.Next()
spotify_iface = dbus.Interface(spotify, 'org.freedesktop.DBus.Properties')
props = spotify_iface.Get('org.mpris.MediaPlayer2.Player', 'Metadata')
if (sys.version_info > (3, 0)):
print(str(props['xesam:artist'][0]) + " - " + str(props['xesam:title']))
else:
print(props['xesam:artist'][0] + " - " + props['xesam:title']).encode('utf-8')
exit
except dbus.exceptions.DBusException:
exit

View File

@@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
{description}
Copyright (C) {year} {fullname}
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
{signature of Ty Coon}, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View File

@@ -0,0 +1,36 @@
# time
Shows the current time and changes displayed timezone on click.
![](time.png)
# Dependencies
perl
# Installation
To use with i3blocks, copy the below configuration into your i3blocks configuration file
```INI
[time]
command=$SCRIPT_DIR/time
interval=1
#TZ_FILE=~/.tz
STRFTIME_FORMAT=%Y-%m-%d %H:%M
TZONES=$DEFAULT_TZ,Brazil/East,Australia/Brisbane,Asia/Calcutta
TZ_LABELS=,Brazil,AU,Hyderabad
```
See [strftime](https://linux.die.net/man/3/strftime) for allowed strftime formats.
Here TZONES is a comma separated list of timeszones, see /usr/share/zoneinfo (Olson DB)
for allowed timezones. One exception is that the string $DEFAULT_TZ
is also allowed and represents whatever your current system timezone is.
Also TZ_LABELS is a comma separated list of how to label each timezone in case you prefer
not to see the full timezone as part of the label.
E.g. you may want it to say "12:34 (US)" instead of "12:34 (America/Chicago)".
Labels are allowed to be empty,
in which case the script omits parentheses.
For example, in the config above, the label for the default timezone is omitted.

View File

@@ -0,0 +1,7 @@
[time]
command=$SCRIPT_DIR/time
interval=1
#TZ_FILE=~/.tz
STRFTIME_FORMAT=%Y-%m-%d %R
TZONES=$DEFAULT_TZ,Brazil/East,Australia/Brisbane,Asia/Calcutta
TZ_LABELS=,Brazil,AU,Hyderabad

View File

@@ -0,0 +1,101 @@
#!/usr/bin/env perl
use strict;
use warnings;
use POSIX qw/strftime/;
my $click = $ENV{BLOCK_BUTTON} || 0;
my $format = $ENV{BLOCK_INSTANCE} || $ENV{STRFTIME_FORMAT} || "%H:%M";
my $tz_file = shift || $ENV{TZ_FILE} || "$ENV{HOME}/.tz";
$tz_file = glob($tz_file);
my $default_tz = get_default_tz();
my $tzones = $ENV{TZONES} || '$DEFAULT_TZ';
$tzones =~ s/\$DEFAULT_TZ/$default_tz/g;
my @tz_list = split(/,/, $tzones);
my @tz_labels = split(/,/, $ENV{TZ_LABELS} || "");
if (scalar(@tz_list) != scalar(@tz_labels)) {
@tz_labels = @tz_list;
}
my $current_tz;
if ($click == 1) {
$current_tz = get_tz();
my %tzmap;
$tzmap{""} = $tz_list[0];
my $prev = $tz_list[0];
foreach my $tz (@tz_list) {
$tzmap{$prev} = $tz;
$prev = $tz;
}
$tzmap{$prev} = $tz_list[0];
if (exists $tzmap{$current_tz}) {
set_tz($tzmap{$current_tz});
$current_tz = $tzmap{$current_tz};
}
}
# How each timezone will be displayed in the bar.
my %display_map;
for (my $i=0; $i < scalar(@tz_list); $i++) {
$display_map{$tz_list[$i]} = $tz_labels[$i];
}
if (!defined $current_tz) {
$current_tz = get_tz();
set_tz($current_tz);
}
$ENV{TZ} = $current_tz;
my $tz_display = "";
if (!exists $display_map{$ENV{TZ}}) {
$ENV{TZ} = $tz_list[0];
set_tz($tz_list[0]);
}
$tz_display = $display_map{$ENV{TZ}};
binmode(STDOUT, ":utf8");
my $time = strftime($format, localtime());
if ($tz_display eq "") {
print "$time\n";
} else {
print "$time ($tz_display)\n";
}
sub get_tz {
my $current_tz;
if (-f $tz_file) {
open my $fh, '<', $tz_file || die "Couldn't open file: $tz_file";
$current_tz = <$fh>;
chomp $current_tz;
close $fh;
}
return $current_tz || get_default_tz();
}
sub set_tz {
my $tz = shift;
open my $fh, '>', $tz_file || die "Couldn't open file: $tz_file";
print $fh $tz;
close $fh;
}
sub get_default_tz {
my $tz = "Europe/London";
if (-f "/etc/timezone") {
open my $fh, '<', "/etc/timezone" || die "Couldn't open file: /etc/timezone";
$tz = <$fh>;
chomp $tz;
close $fh;
} elsif (-l "/etc/localtime") {
$tz = readlink "/etc/localtime";
$tz = (split /zoneinfo\//, $tz)[-1];
}
return $tz;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@@ -0,0 +1,49 @@
# volume
Shows the current system volume. The first parameter sets the step (and units
to display). The second parameter overrides the mixer selection.
See the script for details.
Scrolling on the block changes the volume. Right clicking toggles mute.
![](volume.png)
# Usage
This block can be run on an interval or by signal. To run the block using a
signal, it is recommended to add the following to your i3 config.
```
# change volume or toggle mute
bindsym XF86AudioRaiseVolume exec amixer -q -D pulse sset Master 5%+ && pkill -RTMIN+10 i3blocks
bindsym XF86AudioLowerVolume exec amixer -q -D pulse sset Master 5%- && pkill -RTMIN+10 i3blocks
bindsym XF86AudioMute exec amixer -q -D pulse sset Master toggle && pkill -RTMIN+10 i3blocks
```
where the number `10` in `-RTMIN+10` can be replaced to another signal number,
as long as it agrees what you put for `signal=` in your i3blocks config.
# Config
```
[volume]
command=$SCRIPT_DIR/volume
#LABEL=♪
LABEL=VOL
interval=once
signal=10
#STEP=5%
#MIXER=[determined automatically]
#SCONTROL=[determined automatically]
#NATURAL_MAPPING=0
```
For PulseAudio users, MIXER is usually "pulse" or "default".
For Jack/Jack2 users, MIXER is usually "jackplug".
For ALSA users, use "default" for your primary card, or "hw:#"
where # is the number of the card desired.
For a list of available SCONTROL options, use `amixer -D $MIXER scontrols`.
If `NATURAL_MAPPING` is set to a non-zero value, the `-M` flag is used for `amixer`, enabling
a volume mapping more natural for the human ear, as used in alsamixer.

View File

@@ -0,0 +1,9 @@
[volume]
command=$SCRIPT_DIR/volume
#LABEL=♪
LABEL=VOL
interval=once
signal=10
#STEP=5%
#MIXER=[determined automatically]
#SCONTROL=[determined automatically]

View File

@@ -0,0 +1,91 @@
#!/usr/bin/env bash
# Copyright (C) 2014 Julien Bonjean <julien@bonjean.info>
# Copyright (C) 2014 Alexander Keller <github@nycroth.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#------------------------------------------------------------------------
# The second parameter overrides the mixer selection
# For PulseAudio users, eventually use "pulse"
# For Jack/Jack2 users, use "jackplug"
# For ALSA users, you may use "default" for your primary card
# or you may use hw:# where # is the number of the card desired
if [[ -z "$MIXER" ]] ; then
MIXER="default"
if command -v pulseaudio >/dev/null 2>&1 && pulseaudio --check ; then
# pulseaudio is running, but not all installations use "pulse"
if amixer -D pulse info >/dev/null 2>&1 ; then
MIXER="pulse"
fi
fi
[ -n "$(lsmod | grep jack)" ] && MIXER="jackplug"
MIXER="${2:-$MIXER}"
fi
# The instance option sets the control to report and configure
# This defaults to the first control of your selected mixer
# For a list of the available, use `amixer -D $Your_Mixer scontrols`
if [[ -z "$SCONTROL" ]] ; then
SCONTROL="${BLOCK_INSTANCE:-$(amixer -D $MIXER scontrols |
sed -n "s/Simple mixer control '\([^']*\)',0/\1/p" |
head -n1
)}"
fi
# The first parameter sets the step to change the volume by (and units to display)
# This may be in in % or dB (eg. 5% or 3dB)
if [[ -z "$STEP" ]] ; then
STEP="${1:-5%}"
fi
# AMIXER(1):
# "Use the mapped volume for evaluating the percentage representation like alsamixer, to be
# more natural for human ear."
NATURAL_MAPPING=${NATURAL_MAPPING:-0}
if [[ "$NATURAL_MAPPING" != "0" ]] ; then
AMIXER_PARAMS="-M"
fi
#------------------------------------------------------------------------
capability() { # Return "Capture" if the device is a capture device
amixer $AMIXER_PARAMS -D $MIXER get $SCONTROL |
sed -n "s/ Capabilities:.*cvolume.*/Capture/p"
}
volume() {
amixer $AMIXER_PARAMS -D $MIXER get $SCONTROL $(capability)
}
format() {
perl_filter='if (/.*\[(\d+%)\] (\[(-?\d+.\d+dB)\] )?\[(on|off)\]/)'
perl_filter+='{CORE::say $4 eq "off" ? "MUTE" : "'
# If dB was selected, print that instead
perl_filter+=$([[ $STEP = *dB ]] && echo '$3' || echo '$1')
perl_filter+='"; exit}'
output=$(perl -ne "$perl_filter")
echo "$LABEL$output"
}
#------------------------------------------------------------------------
case $BLOCK_BUTTON in
3) amixer $AMIXER_PARAMS -q -D $MIXER sset $SCONTROL $(capability) toggle ;; # right click, mute/unmute
4) amixer $AMIXER_PARAMS -q -D $MIXER sset $SCONTROL $(capability) ${STEP}+ unmute ;; # scroll up, increase
5) amixer $AMIXER_PARAMS -q -D $MIXER sset $SCONTROL $(capability) ${STEP}- unmute ;; # scroll down, decrease
esac
volume | format

Binary file not shown.

After

Width:  |  Height:  |  Size: 997 B

View File

@@ -1,121 +1,491 @@
# config is for this fork:
# https://github.com/pijulius/picom
# https://aur.archlinux.org/packages/picom-pijulius-git
#################################
# Animations #
#################################
# Animations (requires pijulius)
animations = true;
animation-clamping = true;
animation-delta = 12;
animation-dampening = 20.0;
animation-stiffness = 500.0;
animation-for-open-window = "zoom";
animation-for-menu-window = "slide-down";
animation-for-transient-window = "zoom";
animation-for-workspace-switch-in = "zoom";
animation-for-workspace-switch-out = "zoom";
##################################
# Corners #
#################################
# requires: https://github.com/sdhand/compton or https://github.com/jonaburg/picom
corner-radius = 20;
rounded-corners-exclude = [
"class_g = 'i3-frame'",
"class_g = 'Polybar'",
"class_g = 'i3bar'",
];
round-borders = 20;
round-borders-exclude = [
"class_g = 'i3-frame'",
"class_g = 'Polybar'",
"class_g = 'i3bar'",
];
#################################
# Shadows #
#################################
shadow = true;
shadow-radius = 15;
shadow-opacity = 0.85;
shadow-offset-x = -12;
shadow-offset-y = -12;
shadow-color = "#000000";
shadow-ignore-shaped = false;
shadow-exclude = [
"name = 'Notification'",
"class_g ?= 'Notify-osd'",
"_GTK_FRAME_EXTENTS@:c",
"class_g = 'org.wezfurlong.wezterm'",
];
clip-shadow-above = [];
# Enabled client-side shadows on windows. Note desktop windows
# (windows with '_NET_WM_WINDOW_TYPE_DESKTOP') never get shadow,
# unless explicitly requested using the wintypes option.
#
# shadow = false
shadow = false;
# The blur radius for shadows, in pixels. (defaults to 12)
# shadow-radius = 12
shadow-radius = 12;
# The opacity of shadows. (0.0 - 1.0, defaults to 0.75)
#shadow-opacity = .75
# The left offset for shadows, in pixels. (defaults to -15)
# shadow-offset-x = -15
#shadow-offset-x = -150;
# The top offset for shadows, in pixels. (defaults to -15)
# shadow-offset-y = -15
#shadow-offset-y = -15;
# Avoid drawing shadows on dock/panel windows. This option is deprecated,
# you should use the *wintypes* option in your config file instead.
#
# no-dock-shadow = false
# Don't draw shadows on drag-and-drop windows. This option is deprecated,
# you should use the *wintypes* option in your config file instead.
#
# no-dnd-shadow = false
# Red color value of shadow (0.0 - 1.0, defaults to 0).
# shadow-red = 0
# Green color value of shadow (0.0 - 1.0, defaults to 0).
# shadow-green = 0
# Blue color value of shadow (0.0 - 1.0, defaults to 0).
# shadow-blue = 0
# Do not paint shadows on shaped windows. Note shaped windows
# here means windows setting its shape through X Shape extension.
# Those using ARGB background is beyond our control.
# Deprecated, use
# shadow-exclude = 'bounding_shaped'
# or
# shadow-exclude = 'bounding_shaped && !rounded_corners'
# instead.
#
# shadow-ignore-shaped = ''
# Specify a list of conditions of windows that should have no shadow.
#
# examples:
# shadow-exclude = "n:e:Notification";
#
# shadow-exclude = []
# Specify a X geometry that describes the region in which shadow should not
# be painted in, such as a dock window region. Use
# shadow-exclude-reg = "x10+0+0"
# for example, if the 10 pixels on the bottom of the screen should not have shadows painted on.
#
# shadow-exclude-reg = ""
# Crop shadow of a window fully on a particular Xinerama screen to the screen.
# xinerama-shadow-crop = false
#################################
# Fading #
#################################
fading = true;
# Fade windows in/out when opening/closing and when opacity changes,
# unless no-fading-openclose is used.
# fading = false
fading = false;
# Opacity change between steps while fading in. (0.01 - 1.0, defaults to 0.028)
# fade-in-step = 0.028
fade-in-step = 0.03;
# Opacity change between steps while fading out. (0.01 - 1.0, defaults to 0.03)
# fade-out-step = 0.03
fade-out-step = 0.03;
# The time between steps in fade step, in milliseconds. (> 0, defaults to 10)
# fade-delta = 10
# Specify a list of conditions of windows that should not be faded.
# don't need this, we disable fading for all normal windows with wintypes: {}
fade-exclude = [
"class_g = 'slop'" # maim
]
# Do not fade on window open/close.
# no-fading-openclose = false
# Do not fade destroyed ARGB windows with WM frame. Workaround of bugs in Openbox, Fluxbox, etc.
# no-fading-destroyed-argb = false
#################################
# Transparency / Opacity #
#################################
inactive-opacity = 1.0;
frame-opacity = 1.0;
# Opacity of inactive windows. (0.1 - 1.0, defaults to 1.0)
# inactive-opacity = 1
inactive-opacity = 0.9;
# Opacity of window titlebars and borders. (0.1 - 1.0, disabled by default)
# frame-opacity = 1.0
frame-opacity = 0.5;
# Default opacity for dropdown menus and popup menus. (0.0 - 1.0, defaults to 1.0)
# menu-opacity = 1.0
# menu-opacity is depreciated use dropdown-menu and popup-menu instead.
#If using these 2 below change their values in line 510 & 511 aswell
popup_menu = { opacity = 0.8; }
dropdown_menu = { opacity = 0.8; }
# Let inactive opacity set by -i override the '_NET_WM_OPACITY' values of windows.
# inactive-opacity-override = true
inactive-opacity-override = false;
# Default opacity for active windows. (0.0 - 1.0, defaults to 1.0)
active-opacity = 1.0;
inactive-dim = 0.0;
focus-exclude = [];
# Dim inactive windows. (0.0 - 1.0, defaults to 0.0)
# inactive-dim = 0.0
# Specify a list of conditions of windows that should always be considered focused.
# focus-exclude = []
focus-exclude = [
"class_g = 'rofi'",
];
# Use fixed inactive dim value, instead of adjusting according to window opacity.
# inactive-dim-fixed = 1.0
# Specify a list of opacity rules, in the format `PERCENT:PATTERN`,
# like `50:name *= "Firefox"`. picom-trans is recommended over this.
# Note we don't make any guarantee about possible conflicts with other
# programs that set '_NET_WM_WINDOW_OPACITY' on frame or client windows.
# example:
# opacity-rule = [ "80:class_g = 'URxvt'" ];
#
# opacity-rule = []
opacity-rule = [
"75:class_g = 'Conky'",
"95:class_g = 'obsidian'",
"95:class_g = 'inkdrop'",
"95:class_g = 'Thunar'",
"85:class_g = 'org.wezfurlong.wezterm'",
"85:class_g = 'discord'",
"85:class_g = 'Spotify'",
];
#################################
# Corners #
#################################
corner-radius = 12;
rounded-corners-exclude = [
"class_g = 'polybar'",
"class_g = 'Polybar'",
"class_g = 'csgo_linux64'",
# "class_g = 'rofi'",
# "class_g = 'Rofi'",
"class_g = 'osu!'",
"class_g = 'Dunst'",
"class_g = 'awesome'",
# "!_PICOM_CORNERS@:32c = 1"
];
#################################
# Animations #
#################################
animations = true;
animation-for-open-window = "zoom";
animation-for-transient-window = "none";
animation-for-unmap-window = "zoom";
animation-for-workspace-switch-in = "none";
animation-for-workspace-switch-out = "none";
animation-for-menu-window = "none";
animation-stiffness = 250;
animation-dampening = 20;
animation-window-mass = 0.069;
animation-clamping = true;
#################################
# Background-Blurring #
#################################
blur-method = "dual_kawase";
blur-size = 1;
blur-background = true;
blur-background-frame = false;
blur-background-fixed = false;
blur-kern = "3x3box";
# Parameters for background blurring, see the *BLUR* section for more information.
# blur-method =
# blur-size = 12
#
# blur-deviation = false
# Blur background of semi-transparent / ARGB windows.
# Bad in performance, with driver-dependent behavior.
# The name of the switch may change without prior notifications.
#
# blur-background = true;
# Blur background of windows when the window frame is not opaque.
# Implies:
# blur-background
# Bad in performance, with driver-dependent behavior. The name may change.
#
# blur-background-frame = false;
# Use fixed blur strength rather than adjusting according to window opacity.
# blur-background-fixed = false;
# Specify the blur convolution kernel, with the following format:
# example:
# blur-kern = "5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1";
#
# blur-kern = ''
# blur-kern = "3x3box";
blur: {
# requires: https://github.com/ibhagwan/picom
method = "kawase";
#method = "kernel";
strength = 3;
# deviation = 1.0;
# kernel = "11x11gaussian";
background = false;
background-frame = false;
background-fixed = false;
kern = "3x3box";
}
# Exclude conditions for background blur.
blur-background-exclude = [
# "class_g = 'Rofi'",
# "class_g = 'rofi'",
"class_g = 'polybar'",
"class_g = 'Polybar'",
"class_g = 'screenkey'",
"class_g = 'Screenkey'",
"class_g = 'slop'",
"class_g = 'Discover-overlay'",
# "class_g = 'org.wezfurlong.wezterm'",
"_GTK_FRAME_EXTENTS@:c"
#"window_type = 'dock'",
#"window_type = 'desktop'",
#"class_g = 'URxvt'",
#
# prevents picom from blurring the background
# when taking selection screenshot with `main`
# https://github.com/naelstrof/maim/issues/130
"class_g = 'slop'",
"_GTK_FRAME_EXTENTS@:c"
];
#################################
# General Settings #
#################################
# Daemonize process. Fork to background after initialization. Causes issues with certain (badly-written) drivers.
# daemon = false
# Specify the backend to use: `xrender`, `glx`, or `xr_glx_hybrid`.
# `xrender` is the default one.
#
experimental-backends = true;
backend = "glx";
vsync = false;
#backend = "xrender";
# Enable/disable VSync.
# vsync = false
vsync = true
# Enable remote control via D-Bus. See the *D-BUS API* section below for more details.
# dbus = false
# Try to detect WM windows (a non-override-redirect window with no
# child that has 'WM_STATE') and mark them as active.
#
# mark-wmwin-focused = false
mark-wmwin-focused = true;
# Mark override-redirect windows that doesn't have a child window with 'WM_STATE' focused.
# mark-ovredir-focused = false
mark-ovredir-focused = true;
# Try to detect windows with rounded corners and don't consider them
# shaped windows. The accuracy is not very high, unfortunately.
#
# detect-rounded-corners = false
detect-rounded-corners = true;
# Detect '_NET_WM_OPACITY' on client windows, useful for window managers
# not passing '_NET_WM_OPACITY' of client windows to frame windows.
#
# detect-client-opacity = false
detect-client-opacity = true;
unredir-if-possible = false;
detect-transient = true;
detect-client-leader = true;
use-damage = true;
max-brightness = 1.0;
# Specify refresh rate of the screen. If not specified or 0, picom will
# try detecting this with X RandR extension.
#
# refresh-rate = 60
refresh-rate = 0
# Limit picom to repaint at most once every 1 / 'refresh_rate' second to
# boost performance. This should not be used with
# vsync drm/opengl/opengl-oml
# as they essentially does sw-opti's job already,
# unless you wish to specify a lower refresh rate than the actual value.
#
# sw-opti =
# Use EWMH '_NET_ACTIVE_WINDOW' to determine currently focused window,
# rather than listening to 'FocusIn'/'FocusOut' event. Might have more accuracy,
# provided that the WM supports it.
#
# use-ewmh-active-win = false
# Unredirect all windows if a full-screen opaque window is detected,
# to maximize performance for full-screen windows. Known to cause flickering
# when redirecting/unredirecting windows. paint-on-overlay may make the flickering less obvious.
#
# unredir-if-possible = false
# Delay before unredirecting the window, in milliseconds. Defaults to 0.
# unredir-if-possible-delay = 0
# Conditions of windows that shouldn't be considered full-screen for unredirecting screen.
# unredir-if-possible-exclude = []
# Use 'WM_TRANSIENT_FOR' to group windows, and consider windows
# in the same group focused at the same time.
#
# detect-transient = false
detect-transient = true
# Use 'WM_CLIENT_LEADER' to group windows, and consider windows in the same
# group focused at the same time. 'WM_TRANSIENT_FOR' has higher priority if
# detect-transient is enabled, too.
#
# detect-client-leader = false
detect-client-leader = true
# Resize damaged region by a specific number of pixels.
# A positive value enlarges it while a negative one shrinks it.
# If the value is positive, those additional pixels will not be actually painted
# to screen, only used in blur calculation, and such. (Due to technical limitations,
# with use-damage, those pixels will still be incorrectly painted to screen.)
# Primarily used to fix the line corruption issues of blur,
# in which case you should use the blur radius value here
# (e.g. with a 3x3 kernel, you should use `--resize-damage 1`,
# with a 5x5 one you use `--resize-damage 2`, and so on).
# May or may not work with *--glx-no-stencil*. Shrinking doesn't function correctly.
#
# resize-damage = 1
# Specify a list of conditions of windows that should be painted with inverted color.
# Resource-hogging, and is not well tested.
#
# invert-color-include = []
# GLX backend: Avoid using stencil buffer, useful if you don't have a stencil buffer.
# Might cause incorrect opacity when rendering transparent content (but never
# practically happened) and may not work with blur-background.
# My tests show a 15% performance boost. Recommended.
#
# glx-no-stencil = false
# GLX backend: Avoid rebinding pixmap on window damage.
# Probably could improve performance on rapid window content changes,
# but is known to break things on some drivers (LLVMpipe, xf86-video-intel, etc.).
# Recommended if it works.
#
# glx-no-rebind-pixmap = false
# Disable the use of damage information.
# This cause the whole screen to be redrawn everytime, instead of the part of the screen
# has actually changed. Potentially degrades the performance, but might fix some artifacts.
# The opposing option is use-damage
#
# no-use-damage = false
#use-damage = true (Causing Weird Black semi opaque rectangles when terminal is opened)
#Changing use-damage to false fixes the problem
use-damage = false
# Use X Sync fence to sync clients' draw calls, to make sure all draw
# calls are finished before picom starts drawing. Needed on nvidia-drivers
# with GLX backend for some users.
#
# xrender-sync-fence = false
# GLX backend: Use specified GLSL fragment shader for rendering window contents.
# See `compton-default-fshader-win.glsl` and `compton-fake-transparency-fshader-win.glsl`
# in the source tree for examples.
#
# glx-fshader-win = ''
# Force all windows to be painted with blending. Useful if you
# have a glx-fshader-win that could turn opaque pixels transparent.
#
# force-win-blend = false
# Do not use EWMH to detect fullscreen windows.
# Reverts to checking if a window is fullscreen based only on its size and coordinates.
#
#no-ewmh-fullscreen = false
# Dimming bright windows so their brightness doesn't exceed this set value.
# Brightness of a window is estimated by averaging all pixels in the window,
# so this could comes with a performance hit.
# Setting this to 1.0 disables this behaviour. Requires --use-damage to be disabled. (default: 1.0)
#
# max-brightness = 1.0
# Make transparent windows clip other windows like non-transparent windows do,
# instead of blending on top of them.
#
# transparent-clipping = false
# Set the log level. Possible values are:
# "trace", "debug", "info", "warn", "error"
# in increasing level of importance. Case doesn't matter.
# If using the "TRACE" log level, it's better to log into a file
# using *--log-file*, since it can generate a huge stream of logs.
#
# log-level = "debug"
log-level = "info";
# Set the log file.
# If *--log-file* is never specified, logs will be written to stderr.
# Otherwise, logs will to written to the given file, though some of the early
# logs might still be written to the stderr.
# When setting this option from the config file, it is recommended to use an absolute path.
#
# log-file = '/path/to/your/log/file'
# Show all X errors (for debugging)
# show-all-xerrors = false
# Write process ID to a file.
# write-pid-path = '/path/to/your/log/file'
# Window type settings
#
# 'WINDOW_TYPE' is one of the 15 window types defined in EWMH standard:
# "unknown", "desktop", "dock", "toolbar", "menu", "utility",
# "splash", "dialog", "normal", "dropdown_menu", "popup_menu",
# "tooltip", "notification", "combo", and "dnd".
#
# Following per window-type options are available: ::
#
# fade, shadow:::
# Controls window-type-specific shadow and fade settings.
#
# opacity:::
# Controls default opacity of the window type.
#
# focus:::
# Controls whether the window of this type is to be always considered focused.
# (By default, all window types except "normal" and "dialog" has this on.)
#
# full-shadow:::
# Controls whether shadow is drawn under the parts of the window that you
# normally won't be able to see. Useful when the window has parts of it
# transparent, and you want shadows in those areas.
#
# redir-ignore:::
# Controls whether this type of windows should cause screen to become
# redirected again after been unredirected. If you have unredir-if-possible
# set, and doesn't want certain window to cause unnecessary screen redirection,
# you can set this to `true`.
#
wintypes:
{
normal = { fade = false; shadow = false; }
tooltip = { fade = false; shadow = true; opacity = 1.0; focus = true; full-shadow = false; };
tooltip = { fade = true; shadow = true; opacity = 0.75; focus = true; full-shadow = false; };
dock = { shadow = false; }
dnd = { shadow = false; }
popup_menu = { opacity = 1.0; }
dropdown_menu = { opacity = 1.0; }
popup_menu = { opacity = 0.8; }
dropdown_menu = { opacity = 0.8; }
};

View File

@@ -1,121 +0,0 @@
# config is for this fork:
# https://github.com/pijulius/picom
# https://aur.archlinux.org/packages/picom-pijulius-git
#################################
# Shadows #
#################################
shadow = true;
shadow-radius = 15;
shadow-opacity = 0.85;
shadow-offset-x = -12;
shadow-offset-y = -12;
shadow-color = "#000000";
shadow-ignore-shaped = false;
shadow-exclude = [
"name = 'Notification'",
"class_g ?= 'Notify-osd'",
"_GTK_FRAME_EXTENTS@:c",
"class_g = 'org.wezfurlong.wezterm'",
];
clip-shadow-above = [];
#################################
# Fading #
#################################
fading = true;
fade-in-step = 0.03;
fade-out-step = 0.03;
#################################
# Transparency / Opacity #
#################################
inactive-opacity = 1.0;
frame-opacity = 1.0;
inactive-opacity-override = false;
active-opacity = 1.0;
inactive-dim = 0.0;
focus-exclude = [];
opacity-rule = [
"75:class_g = 'Conky'",
"95:class_g = 'obsidian'",
"95:class_g = 'inkdrop'",
"95:class_g = 'Thunar'",
];
#################################
# Corners #
#################################
corner-radius = 12;
rounded-corners-exclude = [
"class_g = 'polybar'",
"class_g = 'Polybar'",
"class_g = 'csgo_linux64'",
# "class_g = 'rofi'",
# "class_g = 'Rofi'",
"class_g = 'osu!'",
"class_g = 'Dunst'",
"class_g = 'awesome'",
# "!_PICOM_CORNERS@:32c = 1"
];
#################################
# Animations #
#################################
animations = true;
animation-for-open-window = "zoom";
animation-for-transient-window = "none";
animation-for-unmap-window = "zoom";
animation-for-workspace-switch-in = "none";
animation-for-workspace-switch-out = "none";
animation-for-menu-window = "none";
animation-stiffness = 250;
animation-dampening = 20;
animation-window-mass = 0.069;
animation-clamping = true;
#################################
# Background-Blurring #
#################################
blur-method = "dual_kawase";
blur-size = 1;
blur-background = true;
blur-background-frame = false;
blur-background-fixed = false;
blur-kern = "3x3box";
blur-background-exclude = [
# "class_g = 'Rofi'",
# "class_g = 'rofi'",
"class_g = 'polybar'",
"class_g = 'Polybar'",
"class_g = 'screenkey'",
"class_g = 'Screenkey'",
"class_g = 'slop'",
"class_g = 'Discover-overlay'",
# "class_g = 'org.wezfurlong.wezterm'",
"_GTK_FRAME_EXTENTS@:c"
];
#################################
# General Settings #
#################################
backend = "glx";
vsync = false;
mark-ovredir-focused = true;
detect-rounded-corners = true;
detect-client-opacity = true;
unredir-if-possible = false;
detect-transient = true;
detect-client-leader = true;
use-damage = true;
max-brightness = 1.0;
log-level = "info";
wintypes:
{
normal = { fade = false; shadow = false; }
tooltip = { fade = false; shadow = true; opacity = 1.0; focus = true; full-shadow = false; };
dock = { shadow = false; }
dnd = { shadow = false; }
popup_menu = { opacity = 1.0; }
dropdown_menu = { opacity = 1.0; }
};

View File

@@ -0,0 +1,24 @@
[colors]
; background = #1e222a
background = #1A1826
; foreground = #c8ccd4
foreground = #C3BAC6
color0 = #282c34
color1 = #e06c75
color2 = #98c379
color3 = #e5c07b
color4 = #61afef
color5 = #c678dd
color6 = #56b6c2
color7 = #abb2bf
color8 = #545862
color9 = #e06c75
color10 = #98c379
color11 = #e5c07b
color12 = #61afef
color13 = #c678dd
color14 = #56b6c2
color15 = #c8ccd4
dark-light = #272A2B
active-light = #313435

View File

@@ -0,0 +1,5 @@
# vim: filetype=config
include-file = "~/.config/polybar/colors.ini"
include-file = "~/.config/polybar/modules.ini"
include-file = "~/.config/polybar/main-bar.ini"
include-file = "~/.config/polybar/settings.ini"

View File

@@ -0,0 +1,10 @@
# font-0 = CaskaydiaCove Nerd Font:style=Regular:pixelsize=11:antialias=true;2.5
font-0 = DejaVu Sans Mono Nerd Font:style=Bold:pixelsize=14;3
font-1 = DejaVu Sans Mono Nerd Font:size=14;4
font-2 = Material Design Icons:style=Regular:size=12;3
font-6 = unifont:fontformat=truetype:size=11;3
font-4 = DejaVu Sans Mono Nerd Font:size=14
font-5 = DejaVu Sans Mono:size=11
font-3 = Weather Icons:size=12;1
font-7 = Material Icons:size=12;0
# font-4 = Material Design Icons:style=Regular:pixelsize=11:antialias=true;2.5

View File

@@ -0,0 +1,8 @@
if type "xrandr"; then
for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
MONITOR=$m polybar --reload main &
done
else
polybar --reload main &
fi

View File

@@ -0,0 +1,31 @@
[bar/main]
monitor = ${env:MONITOR:}
include-file = "~/.config/polybar/fonts.ini"
width = 100%
height = 30
bottom = true
background = ${colors.background}
foreground = ${colors.foreground}
padding-right = 1
padding-left = 1
line-size = 1
border-top-size = 5
border-bottom-size = 5
border-top-color = ${colors.background}
border-bottom-color = ${colors.background}
modules-left = round-left i3 round-right empty-space spotify
modules-center = round-left time round-right
modules-right = empty-space round-left network round-right empty-space round-left backlight colored-empty-space audio round-right empty-space round-left cpu temperature colored-empty-space memory round-right empty-space round-left battery round-right
cursor-click = pointer
cursor-scroll = ns-resize
# override-redirect = true

View File

@@ -0,0 +1,266 @@
[module/i3]
type = internal/i3
pin-workspaces = true
enable-click = true
show-urgent = true
format-background = #1E1E2E
label-active-foreground = ${colors.foreground}
label-urgent-foreground = ${colors.foreground}
[module/empty-space]
type = custom/text
content = " "
# =======================================
[module/colored-empty-space]
type = custom/text
content = " "
content-background = #1e1e2e
# =======================================
[module/round-left]
type = custom/text
content = %{T3}%{T-}
content-foreground = #1E1E2E
# =======================================
[module/round-right]
type = custom/text
content = %{T3}%{T-}
content-foreground = #1E1E2E
# =======================================
[module/time]
type = internal/date
interval = 60
format = <label>
format-background = #1E1E2E
format-foreground = #cba6f7
date = %H:%M
time-alt = %a, %b %d%{F-}
label = %{A3:st -e tty-clock -cbt -C 4:} %date%%time% %{A}
# =======================================
[module/audio]
type = internal/pulseaudio
format-volume = %{A3:pavucontrol-qt:} <ramp-volume> <label-volume> %{A}
label-muted = %{A3:pavucontrol-qt:} 婢 0% %{A}
ramp-volume-0 =
ramp-volume-1 =
ramp-volume-2 =
label-volume-foreground = #89DCEB
format-volume-background = #1e1e2e
format-volume-foreground = #89DCEB
format-muted-foreground = #F28FAD
format-muted-background = #1e1e2e
format-muted-padding = 1
# =======================================
[module/cpu]
type = internal/cpu
interval = 0.5
format-prefix ="  "
format = <label>
label = %{A1:st -e btop:} %percentage%% %{A}
format-background = #1e1e2e
format-foreground = #F8BD96
format-prefix-foreground = #F8BD96
# =======================================
[module/temperature]
type = internal/temperature
interval = 0.5
hwmon-path = /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon4/temp1_input
label = " %temperature-c%"
format = <label>
format-background = #1e1e2e
format-foreground = #F8BD96
# =======================================
[module/memory]
type = custom/script
exec = free -m | sed -n 's/^Mem:\s\+[0-9]\+\s\+\([0-9]\+\)\s.\+/\1/p'
interval = 0.5
format = <label>
format-prefix = "﬙ "
label = %{A1:st -e btop:} %output% MB %{A}
# label-padding = 1
format-prefix-foreground = #F8BD96
format-label-foreground = #F8BD96
format-background = #1e1e2e
format-foreground = #F8BD96
# =======================================
[module/network]
type = internal/network
interface = wlp9s0
interface-type = wireless
interval = 1
format-connected = <label-connected>
label-connected = %{A1:nm-connection-editor:} 直 %{A} %essid%
label-connected-foreground = #B5E8E0
label-connected-background = #1e1e2e
label-disconnected = %{A1:nm-connection-editor:} 睊 %{A}
label-disconnected-background = #1e1e2e
label-disconnected-foreground = #F28FAD
# =======================================
[module/battery]
type = internal/battery
battery = BAT0
adapter = ADP1
full-at = 99
poll-interval = 0.5
;format-background = #1e1e2e
format-charging = <animation-charging> <label-charging>
label-charging = %percentage% %
format-charging-foreground = ${colors.color4}
format-charging-background = #1e1e2e
format-discharging = <ramp-capacity> <label-discharging>
label-discharging = %percentage%%
format-discharging-foreground = ${colors.color4}
format-discharging-background = #1e1e2e
format-full-prefix = " "
format-full-prefix-foreground = #ABE9B3
format-foreground = #ABE9B3
format-full-background = #1e1e2e
label-discharging-foreground = #ABE9B3
ramp-capacity-foreground = #ABE9B3
label-charging-foreground = #ABE9B3
label-padding = 1
ramp-capacity-0 = " "
ramp-capacity-1 = " "
ramp-capacity-2 = " "
ramp-capacity-3 = " "
ramp-capacity-4 = "  "
animation-charging-0 = " "
animation-charging-1 = " "
animation-charging-2 = " "
animation-charging-3 = " "
animation-charging-4 = " "
animation-charging-foreground = #ABE9B3
animation-charging-framerate = 750
format-charging-padding = 1
format-discharging-padding = 1
# =======================================
[module/mpd]
type = internal/mpd
host = 127.0.0.1
port = 6600
interval = 2
# 1: left click -> play/pause
# 3: right click -> open ncmpcpp
# 4: scroll up -> next song
# 5: scroll down -> prev song
label-song = %{A1:mpc toggle:}%{A3:st -e ncmpcpp:}%{A4:mpc next:}%{A5:mpc prev:} %artist% - %title% %{A}%{A}%{A}%{A}
format-playing = " <label-song>"
format-paused = " <label-song>"
format-stopped = ""
format-playing-foreground = #989cff
format-paused-foreground = ${colors.foreground}
# ========================================
[module/spotify]
type = custom/script
interval = 1
format-prefix = "阮 "
format-prefix-foreground = #ABE9B3
;format-foreground = #ABE9B3
format = <label>
exec = python ~/.config/polybar/spotify-status.py -f '{song} | {artist}'
;format-underline = #ABE9B3
;control players (optional)
click-left = playerctl --player=spotify play-pause
click-right = playerctl --player=spotify next
click-middle = playerctl --player=spotify previous
# ========================================
[module/wired-network]
type = internal/network
interface = enp0s31f6
interface-type = wired
interval = 1
format-connected = <label-connected>
format-disconnected = <label-disconnected>
label-connected = "  "
label-disconnected = "  "
label-connected-foreground = #B5E8E0
label-disconnected-foreground = #F28FAD
format-connected-background = #1e1e2e
format-disconnected-background = 1e1e2e
# ========================================
[module/speedtest]
type = custom/script
click-left = "~/.config/polybar/polybar-speedtest"
format-prefix =
format-prefix-foreground = {colors.foreground}
# ========================================
[module/backlight]
type = internal/backlight
card = intel_backlight
use-actual-brightness = true
enable-scroll = false
format =" <ramp> <label>"
label = "%percentage%%"
ramp-foreground = #89DCEB
label-foreground = #89DCEB
format-background = #1e1e2e
; only applies if <ramp> is used
ramp-0 = "  "
ramp-1 = "  "
# =========================================
[module/weather]
type = custom/script
exec = sudo sh ~/.config/polybar/openweathermap-simple
interval = 600
format-background = #1e1e2e
format-foreground = #cba6f7
# =========================================
[module/update]
type = custom/script
exec = sh ~/.config/polybar/pacman-aurhelper.sh
format = <label>
format-prefix = "ﮮ "
interval = 600
format-background = #1e1e2e
format-foreground = #cba6f7
click-left = exec alacritty -e sudo pacman -Syu

View File

@@ -0,0 +1,75 @@
#!/bin/sh
get_icon() {
case $1 in
# Icons for weather-icons
01d) icon="滛 ";;
01n) icon="望 ";;
02d) icon=" ";;
02n) icon=" ";;
03*) icon="摒 ";;
04*) icon=" ";;
09d) icon=" ";;
09n) icon=" ";;
10d) icon=" ";;
10n) icon=" ";;
11d) icon=" ";;
11n) icon=" ";;
13d) icon=" ";;
13n) icon=" ";;
50d) icon=" ";;
50n) icon=" ";;
*) icon="";
# Icons for Font Awesome 5 Pro
#01d) icon="";;
#01n) icon="";;
#02d) icon="";;
#02n) icon="";;
#03d) icon="";;
#03n) icon="";;
#04*) icon="";;
#09*) icon="";;
#10d) icon="";;
#10n) icon="";;
#11*) icon="";;
#13*) icon="";;
#50*) icon="";;
#*) icon="";
esac
echo $icon
}
KEY="068ca68a158633ad304b3636b989758c"
CITY="3054643"
UNITS="metric"
SYMBOL="°C "
API="https://api.openweathermap.org/data/2.5"
if [ -n "$CITY" ]; then
if [ "$CITY" -eq "$CITY" ] 2>/dev/null; then
CITY_PARAM="id=$CITY"
else
CITY_PARAM="q=$CITY"
fi
weather=$(curl -sf "$API/weather?appid=$KEY&$CITY_PARAM&units=$UNITS")
else
location=$(curl -sf https://location.services.mozilla.com/v1/geolocate?key=geoclue)
if [ -n "$location" ]; then
location_lat="$(echo "$location" | jq '.location.lat')"
location_lon="$(echo "$location" | jq '.location.lng')"
weather=$(curl -sf "$API/weather?appid=$KEY&lat=$location_lat&lon=$location_lon&units=$UNITS")
fi
fi
if [ -n "$weather" ]; then
weather_temp=$(echo "$weather" | jq ".main.temp" | cut -d "." -f 1)
weather_icon=$(echo "$weather" | jq -r ".weather[0].icon")
echo "$(get_icon "$weather_icon")"" ""$weather_temp$SYMBOL"
fi

View File

@@ -0,0 +1,22 @@
#!/bin/sh
if ! updates_arch=$(checkupdates 2> /dev/null | wc -l ); then
updates_arch=0
fi
if ! updates_aur=$(yay -Qum 2> /dev/null | wc -l); then
# if ! updates_aur=$(paru -Qum 2> /dev/null | wc -l); then
# if ! updates_aur=$(cower -u 2> /dev/null | wc -l); then
# if ! updates_aur=$(trizen -Su --aur --quiet | wc -l); then
# if ! updates_aur=$(pikaur -Qua 2> /dev/null | wc -l); then
# if ! updates_aur=$(rua upgrade --printonly 2> /dev/null | wc -l); then
updates_aur=0
fi
updates=$((updates_arch + updates_aur))
if [ "$updates" -gt 0 ]; then
echo " $updates"
else
echo ""
fi

View File

@@ -0,0 +1,38 @@
#!/usr/bin/env python3
import os
import argparse
import speedtest
def get_formatted_speed(s,bytes=False):
unit = ""
if s > 1024**3:
s = s / 1024**3
unit = "G"
elif s > 1024**2:
s = s / 1024**2
unit = "M"
elif s > 1024:
s = s / 1024
unit = "K"
if bytes:
return f"{(s/8):.2f} {unit}iB/s"
return f"{s:.2f} {unit}ib/s"
parser = argparse.ArgumentParser()
parser.add_argument('--upload', action="store_true")
parser.add_argument('--bytes', action="store_true")
args= parser.parse_args()
try:
s = speedtest.Speedtest()
except:
exit(0)
if args.upload:
s.upload(pre_allocate=False)
print("▲ " + get_formatted_speed(s.results.upload,args.bytes))
else:
s.download()
print("▼ " + get_formatted_speed(s.results.download,args.bytes))

View File

@@ -0,0 +1,2 @@
[settings]
screenchange-reload = true

View File

@@ -0,0 +1,141 @@
#!/usr/bin/env python
import sys
import dbus
import argparse
parser = argparse.ArgumentParser()
parser.add_argument(
'-t',
'--trunclen',
type=int,
metavar='trunclen'
)
parser.add_argument(
'-f',
'--format',
type=str,
metavar='custom format',
dest='custom_format'
)
parser.add_argument(
'-p',
'--playpause',
type=str,
metavar='play-pause indicator',
dest='play_pause'
)
parser.add_argument(
'--font',
type=str,
metavar='the index of the font to use for the main label',
dest='font'
)
parser.add_argument(
'--playpause-font',
type=str,
metavar='the index of the font to use to display the playpause indicator',
dest='play_pause_font'
)
parser.add_argument(
'-q',
'--quiet',
action='store_true',
help="if set, don't show any output when the current song is paused",
dest='quiet',
)
args = parser.parse_args()
def fix_string(string):
# corrects encoding for the python version used
if sys.version_info.major == 3:
return string
else:
return string.encode('utf-8')
def truncate(name, trunclen):
if len(name) > trunclen:
name = name[:trunclen]
name += '...'
if ('(' in name) and (')' not in name):
name += ')'
return name
# Default parameters
output = fix_string(u'{play_pause} {artist}: {song}')
trunclen = 50
play_pause = fix_string(u'\u25B6,\u23F8') # first character is play, second is paused
label_with_font = '%{{T{font}}}{label}%{{T-}}'
font = args.font
play_pause_font = args.play_pause_font
quiet = args.quiet
# parameters can be overwritten by args
if args.trunclen is not None:
trunclen = args.trunclen
if args.custom_format is not None:
output = args.custom_format
if args.play_pause is not None:
play_pause = args.play_pause
try:
session_bus = dbus.SessionBus()
spotify_bus = session_bus.get_object(
'org.mpris.MediaPlayer2.spotify',
'/org/mpris/MediaPlayer2'
)
spotify_properties = dbus.Interface(
spotify_bus,
'org.freedesktop.DBus.Properties'
)
metadata = spotify_properties.Get('org.mpris.MediaPlayer2.Player', 'Metadata')
status = spotify_properties.Get('org.mpris.MediaPlayer2.Player', 'PlaybackStatus')
# Handle play/pause label
play_pause = play_pause.split(',')
if status == 'Playing':
play_pause = play_pause[0]
elif status == 'Paused':
play_pause = play_pause[1]
else:
play_pause = str()
if play_pause_font:
play_pause = label_with_font.format(font=play_pause_font, label=play_pause)
# Handle main label
artist = fix_string(metadata['xesam:artist'][0]) if metadata['xesam:artist'] else ''
song = fix_string(metadata['xesam:title']) if metadata['xesam:title'] else ''
album = fix_string(metadata['xesam:album']) if metadata['xesam:album'] else ''
if (quiet and status == 'Paused') or (not artist and not song and not album):
print('')
else:
if font:
artist = label_with_font.format(font=font, label=artist)
song = label_with_font.format(font=font, label=song)
album = label_with_font.format(font=font, label=album)
# Add 4 to trunclen to account for status symbol, spaces, and other padding characters
print(truncate(output.format(artist=artist,
song=song,
play_pause=play_pause,
album=album), trunclen + 4))
except Exception as e:
if isinstance(e, dbus.exceptions.DBusException):
print('')
else:
print(e)

View File

@@ -1,445 +0,0 @@
# i3 config file (v4)
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
# Set mod key (Mod1=<Alt>, Mod4=<Super>)
set $mod Mod4
# set default desktop layout (default is tiling)
# workspace_layout tabbed <stacking|tabbed>
# Configure border style <normal|1pixel|pixel xx|none|pixel>
default_border none
default_floating_border normal
# Hide borders
hide_edge_borders none
# change borders
#bindsym $mod+u border none
#bindsym $mod+y border pixel 1
#bindsym $mod+n border normal
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font xft:DejaVu Sans Mono 12
# Hide title bar
default_border pixel 1
default_floating_border pixel 1
for_window [class="^.*"] border pixel 1
# Use Mouse+$mod to drag floating windows
floating_modifier $mod
# start a terminal
bindsym $mod+Return exec wezterm
# kill focused window
bindsym $mod+Shift+q kill
# start program launcher
bindsym $mod+d exec --no-startup-id rofi -show drun
bindsym $mod+z exec --no-startup-id morc_menu
################################################################################################
## sound-section - DO NOT EDIT if you wish to automatically upgrade Alsa -> Pulseaudio later! ##
################################################################################################
exec --no-startup-id volumeicon
##bindsym $mod+Ctrl+m exec terminal -e 'alsamixer'
exec mpris-proxy
exec --no-startup-id start-pulseaudio-x11
exec --no-startup-id pa-applet
bindsym $mod+Ctrl+m exec pavucontrol
################################################################################################
# Screen brightness controls
#bindsym XF86MonBrightnessUp exec "xbacklight -inc 10; notify-send 'brightness up'"
#bindsym XF86MonBrightnessDown exec "xbacklight -dec 10; notify-send 'brightness down'"
# Start Applications
bindsym $mod+Ctrl+b exec terminal -e 'bmenu'
bindsym $mod+F2 exec palemoon
bindsym $mod+F3 exec pcmanfm
# bindsym $mod+F3 exec ranger
bindsym $mod+Shift+F3 exec pcmanfm_pkexec
bindsym $mod+F5 exec terminal -e 'mocp'
bindsym $mod+t exec --no-startup-id pkill picom
bindsym $mod+Ctrl+t exec --no-startup-id picom -b
#bindsym $mod+Shift+d --release exec "killall dunst; exec notify-send 'restart dunst'"
#bindsym Print exec maim -s --format=png /dev/stdout | xclip -selection clipboard -t image/png -i
bindsym Print exec flameshot gui
bindsym $mod+Print --release exec --no-startup-id i3-scrot -w
bindsym $mod+Shift+Print --release exec flameshot --gui
bindsym $mod+Shift+h exec xdg-open /usr/share/doc/manjaro/i3_help.pdf
bindsym $mod+Ctrl+x --release exec --no-startup-id xkill
exec_always --no-startup-id ~/.i3/i3-chrome-tab-dragging.py
# Audio Controls
bindsym XF86AudioPlay exec "mpris-ctl pp && mpris-ctl --player inactive pp"
bindsym XF86AudioNext exec "mpris-ctl --player active next"
bindsym XF86AudioPrev exec "mpris-ctl --player active prev"
# focus_follows_mouse no
# move workspace amongst screens
bindsym $mod+Ctrl+Left move workspace to output left
bindsym $mod+Ctrl+Right move workspace to output right
bindsym $mod+Ctrl+Up move workspace to output up
bindsym $mod+Ctrl+Down move workspace to output down
# change focus
bindsym $mod+j focus left
bindsym $mod+k focus down
bindsym $mod+l focus up
bindsym $mod+semicolon focus right
# alternatively, you can use the cursor keys:
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# move focused window
bindsym $mod+Shift+j move left
bindsym $mod+Shift+k move down
bindsym $mod+Shift+l move up
bindsym $mod+Shift+semicolon move right
# alternatively, you can use the cursor keys:
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
# workspace back and forth (with/without active container)
workspace_auto_back_and_forth yes
bindsym $mod+b workspace back_and_forth
bindsym $mod+Shift+b move container to workspace back_and_forth; workspace back_and_forth
# split orientation
bindsym $mod+h split h;exec notify-send 'tile horizontally'
bindsym $mod+v split v;exec notify-send 'tile vertically'
bindsym $mod+q split toggle
# This is for the i3-alternating-layout package
exec --no-startup-id alternating_layouts.py
# toggle fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
# change container layout (stacked, tabbed, toggle split)
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
# toggle tiling / floating
bindsym $mod+Shift+space floating toggle
# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle
# toggle sticky
bindsym $mod+Shift+s sticky toggle
# focus the parent container
bindsym $mod+a focus parent
# move the currently focused window to the scratchpad
bindsym $mod+Shift+minus move scratchpad
# Show the next scratchpad window or hide the focused scratchpad window.
# If there are multiple scratchpad windows, this command cycles through them.
bindsym $mod+minus scratchpad show
# Workspace names
# to display names or symbols instead of plain workspace numbers you can use
# something like: set $ws1 1:mail
# set $ws2 2:
set $ws1 1
set $ws2 2
set $ws3 3
set $ws4 4
set $ws5 5
set $ws6 6
set $ws7 7
set $ws8 8
set $ws9 9
# switch to workspace
bindsym $mod+1 workspace $ws1
bindsym $mod+2 workspace $ws2
bindsym $mod+3 workspace $ws3
bindsym $mod+4 workspace $ws4
bindsym $mod+5 workspace $ws5
bindsym $mod+6 workspace $ws6
bindsym $mod+7 workspace $ws7
bindsym $mod+8 workspace $ws8
bindsym $mod+9 workspace $ws9
# Move focused container to workspace
bindsym $mod+Ctrl+1 move container to workspace $ws1
bindsym $mod+Ctrl+2 move container to workspace $ws2
bindsym $mod+Ctrl+3 move container to workspace $ws3
bindsym $mod+Ctrl+4 move container to workspace $ws4
bindsym $mod+Ctrl+5 move container to workspace $ws5
bindsym $mod+Ctrl+6 move container to workspace $ws6
bindsym $mod+Ctrl+7 move container to workspace $ws7
bindsym $mod+Ctrl+8 move container to workspace $ws8
bindsym $mod+Ctrl+9 move container to workspace $ws9
# Move to workspace with focused container
bindsym $mod+Shift+1 move container to workspace $ws1; workspace $ws1
bindsym $mod+Shift+2 move container to workspace $ws2; workspace $ws2
bindsym $mod+Shift+3 move container to workspace $ws3; workspace $ws3
bindsym $mod+Shift+4 move container to workspace $ws4; workspace $ws4
bindsym $mod+Shift+5 move container to workspace $ws5; workspace $ws5
bindsym $mod+Shift+6 move container to workspace $ws6; workspace $ws6
bindsym $mod+Shift+7 move container to workspace $ws7; workspace $ws7
bindsym $mod+Shift+8 move container to workspace $ws8; workspace $ws8
bindsym $mod+Shift+9 move container to workspace $ws9; workspace $ws9
# Open applications on specific workspaces
# assign [class="Thunderbird"] $ws1
# assign [class="Pale moon"] $ws2
# assign [class="Pcmanfm"] $ws3
# assign [class="Skype"] $ws5
# Open specific applications in floating mode
for_window [title="alsamixer"] floating enable border pixel 1
for_window [class="calamares"] floating enable border normal
for_window [class="Clipgrab"] floating enable
for_window [title="File Transfer*"] floating enable
for_window [class="fpakman"] floating enable
for_window [class="Galculator"] floating enable border pixel 1
for_window [class="GParted"] floating enable border normal
for_window [title="i3_help"] floating enable sticky enable border normal
for_window [class="Lightdm-settings"] floating enable
for_window [class="Lxappearance"] floating enable sticky enable border normal
for_window [class="Manjaro-hello"] floating enable
for_window [class="Manjaro Settings Manager"] floating enable border normal
for_window [title="MuseScore: Play Panel"] floating enable
for_window [class="Nitrogen"] floating enable sticky enable border normal
for_window [class="Oblogout"] fullscreen enable
for_window [class="octopi"] floating enable
for_window [title="About Pale Moon"] floating enable
for_window [class="Pamac-manager"] floating enable
for_window [class="Pavucontrol"] floating enable
for_window [class="qt5ct"] floating enable sticky enable border normal
for_window [class="Qtconfig-qt4"] floating enable sticky enable border normal
for_window [class="Simple-scan"] floating enable border normal
for_window [class="(?i)System-config-printer.py"] floating enable border normal
for_window [class="Skype"] floating enable border normal
for_window [class="Timeset-gui"] floating enable border normal
for_window [class="(?i)virtualbox"] floating enable border normal
for_window [class="Xfburn"] floating enable
# switch to workspace with urgent window automatically
for_window [urgent=latest] focus
# reload the configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session)
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"
# Set shut down, restart and locking features
bindsym $mod+0 mode "$mode_system"
set $mode_system (l)ock, (e)xit, switch_(u)ser, (s)uspend, (h)ibernate, (r)eboot, (Shift+s)hutdown
mode "$mode_system" {
bindsym l exec --no-startup-id i3exit lock, mode "default"
bindsym s exec --no-startup-id i3exit suspend, mode "default"
bindsym u exec --no-startup-id i3exit switch_user, mode "default"
bindsym e exec --no-startup-id i3exit logout, mode "default"
bindsym h exec --no-startup-id i3exit hibernate, mode "default"
bindsym r exec --no-startup-id i3exit reboot, mode "default"
bindsym Shift+s exec --no-startup-id i3exit shutdown, mode "default"
# exit system mode: "Enter" or "Escape"
bindsym Return mode "default"
bindsym Escape mode "default"
}
# Resize window (you can also use the mouse for that)
bindsym $mod+r mode "resize"
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
# Pressing left will shrink the windows width.
# Pressing right will grow the windows width.
# Pressing up will shrink the windows height.
# Pressing down will grow the windows height.
bindsym j resize shrink width 5 px or 5 ppt
bindsym k resize grow height 5 px or 5 ppt
bindsym l resize shrink height 5 px or 5 ppt
bindsym semicolon resize grow width 5 px or 5 ppt
# same bindings, but for the arrow keys
bindsym Left resize shrink width 5 px or 5 ppt
bindsym Down resize grow height 5 px or 5 ppt
bindsym Up resize shrink height 5 px or 5 ppt
bindsym Right resize grow width 5 px or 5 ppt
# exit resize mode: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
# Autostart applications
exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
exec --no-startup-id nitrogen --restore; sleep 1; picom -b --config /home/$USER/.config/awesome/config/picom.conf
#exec --no-startup-id manjaro-hello
exec --no-startup-id nm-applet
exec --no-startup-id xfce4-power-manager
exec --no-startup-id pamac-tray
exec --no-startup-id clipit
# exec --no-startup-id blueman-applet
# exec_always --no-startup-id sbxkb
# exec --no-startup-id start_conky_maia
# exec --no-startup-id start_conky_green
exec --no-startup-id xidlehook --not-when-fullscreen --not-when-audio --timer 600 'blurlock' ''
exec_always --no-startup-id ff-theme-util
exec_always --no-startup-id fix_xcursor
# Color palette used for the terminal ( ~/.Xresources file )
# Colors are gathered based on the documentation:
# https://i3wm.org/docs/userguide.html#xresources
# Change the variable name at the place you want to match the color
# of your terminal like this:
# [example]
# If you want your bar to have the same background color as your
# terminal background change the line 362 from:
# background #14191D
# to:
# background $term_background
# Same logic applied to everything else.
set_from_resource $term_background background
set_from_resource $term_foreground foreground
set_from_resource $term_color0 color0
set_from_resource $term_color1 color1
set_from_resource $term_color2 color2
set_from_resource $term_color3 color3
set_from_resource $term_color4 color4
set_from_resource $term_color5 color5
set_from_resource $term_color6 color6
set_from_resource $term_color7 color7
set_from_resource $term_color8 color8
set_from_resource $term_color9 color9
set_from_resource $term_color10 color10
set_from_resource $term_color11 color11
set_from_resource $term_color12 color12
set_from_resource $term_color13 color13
set_from_resource $term_color14 color14
set_from_resource $term_color15 color15
# Start i3bar to display a workspace bar (plus the system information i3status if available)
bar {
i3bar_command i3bar
status_command i3blocks
position bottom
font xft:DejaVu Sans Mono 12.5
## please set your primary output first. Example: 'xrandr --output eDP1 --primary'
# tray_output primary
# tray_output eDP1
bindsym button4 nop
bindsym button5 nop
# font xft:URWGothic-Book 11
strip_workspace_numbers yes
colors {
background #282A36
statusline #F8F8F2
separator #44475A
focused_workspace #44475A #44475A #F8F8F2
active_workspace #282A36 #44475A #F8F8F2
inactive_workspace #282A36 #282A36 #BFBFBF
urgent_workspace #FF5555 #FF5555 #F8F8F2
binding_mode #FF5555 #FF5555 #F8F8F2
}
}
# hide/unhide i3status bar
bindsym $mod+m bar mode toggle
# Theme colors
# class border backgr. text indic. child_border
client.focused #6272A4 #6272A4 #F8F8F2 #6272A4 #6272A4
client.focused_inactive #44475A #44475A #F8F8F2 #44475A #44475A
client.unfocused #282A36 #282A36 #BFBFBF #282A36 #282A36
client.urgent #44475A #FF5555 #F8F8F2 #FF5555 #FF5555
client.placeholder #282A36 #282A36 #F8F8F2 #282A36 #282A36
client.background #F8F8F2
#############################
### settings for i3-gaps: ###
#############################
# Set inner/outer gaps
gaps inner 0
gaps outer 0
# Additionally, you can issue commands with the following syntax. This is useful to bind keys to changing the gap size.
# gaps inner|outer current|all set|plus|minus <px>
# gaps inner all set 10
# gaps outer all plus 5
# Smart gaps (gaps used if only more than one container on the workspace)
smart_gaps on
# Smart borders (draw borders around container only if it is not the only container on this workspace)
# on|no_gaps (on=always activate and no_gaps=only activate if the gap size to the edge of the screen is 0)
smart_borders on
# Press $mod+Shift+g to enter the gap mode. Choose o or i for modifying outer/inner gaps. Press one of + / - (in-/decrement for current workspace) or 0 (remove gaps for current workspace). If you also press Shift with these keys, the change will be global for all workspaces.
set $mode_gaps Gaps: (o) outer, (i) inner
set $mode_gaps_outer Outer Gaps: +|-|0 (local), Shift + +|-|0 (global)
set $mode_gaps_inner Inner Gaps: +|-|0 (local), Shift + +|-|0 (global)
bindsym $mod+Shift+g mode "$mode_gaps"
mode "$mode_gaps" {
bindsym o mode "$mode_gaps_outer"
bindsym i mode "$mode_gaps_inner"
bindsym Return mode "default"
bindsym Escape mode "default"
}
mode "$mode_gaps_inner" {
bindsym plus gaps inner current plus 5
bindsym minus gaps inner current minus 5
bindsym 0 gaps inner current set 0
bindsym Shift+plus gaps inner all plus 5
bindsym Shift+minus gaps inner all minus 5
bindsym Shift+0 gaps inner all set 0
bindsym Return mode "default"
bindsym Escape mode "default"
}
mode "$mode_gaps_outer" {
bindsym plus gaps outer current plus 5
bindsym minus gaps outer current minus 5
bindsym 0 gaps outer current set 0
bindsym Shift+plus gaps outer all plus 5
bindsym Shift+minus gaps outer all minus 5
bindsym Shift+0 gaps outer all set 0
bindsym Return mode "default"
bindsym Escape mode "default"
}
# Enable and disable gaps
bindsym $mod+Shift+n gaps inner all set 0; gaps outer all set 0
bindsym $mod+n gaps inner all set 7; gaps outer all set -1
# Deva apps i want to always float
for_window [class="Aeon"] floating enable, sticky enable
for_window [class="Inferno v3.0.1_alpha"] floating enable, sticky enable

View File

@@ -33,7 +33,8 @@ unbind '"'
unbind %
set -g status-right ""
set -g status-style 'bg=#98C379 fg=#282C34'
set -g status-style 'bg=#f5bde6 fg=#24273a'
set -g pane-active-border-style "bg=default fg=#f5bde6"
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'

View File

@@ -1,30 +0,0 @@
[NOW_PLAYING]
command=mpris-ctl info '🎶 %player_name: %track_name - %artist_name'
interval=1
color=#1DB954
[DISK]
command=df -h / | awk '/\//{ printf(" 💾 %sB \n", $4) }'
interval=10
color=#C9E3DB
[CPU]
full_text= CPU: 0.00% @ +00.0°C
command=~/.config/i3blocks/cpu/cpu_info.sh
interval=2
color=#0071C5
[GPU]
full_text= GPU:
command=~/.config/i3blocks/gpu/gpu_info.sh
interval=2
color=#76B900
[MEM]
command=free -h | awk '/Mem:/ { printf(" %5s/%s \n", $3, $2) }'
interval=5
color=#FEC925
[TIME_DATE]
command=date +" %a, %d %b - %H:%M:%S"
interval=1