mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-04-20 16:01:21 +02:00
feat: replace i3blocks/rofi's config with polybar-themes - i3
This commit is contained in:
@@ -5,8 +5,7 @@
|
||||
# config starts here: #
|
||||
#######################
|
||||
|
||||
# Font for window titles. Will also be used by the bar unless a different font
|
||||
# is used in the bar {} block below.
|
||||
# Font for window titles.
|
||||
# This font is widely installed, provides lots of unicode glyphs, right-to-left
|
||||
# text rendering and scalability on retina/hidpi displays (thanks to pango).
|
||||
font pango: Noto Sans Regular 10
|
||||
@@ -85,9 +84,6 @@ bindsym $mod+Return exec kitty
|
||||
# kill focused window
|
||||
bindsym $mod+q kill
|
||||
|
||||
# exit-menu
|
||||
bindsym $mod+Shift+e exec ~/.config/i3/scripts/powermenu
|
||||
|
||||
# Lock the system
|
||||
# lock with a picture:
|
||||
#bindsym $mod+l exec i3lock -i ~/.config/i3/i3-lock-screen.png -p default|win -t
|
||||
@@ -181,9 +177,6 @@ bindsym $mod+w exec /usr/bin/firefox
|
||||
bindsym $mod+n exec /usr/bin/thunar
|
||||
bindsym Print exec scrot ~/%Y-%m-%d-%T-screenshot.png && notify-send "Screenshot saved to ~/$(date +"%Y-%m-%d-%T")-screenshot.png"
|
||||
|
||||
# Power Profiles menu switcher (rofi)
|
||||
bindsym $mod+Shift+p exec ~/.config/i3/scripts/power-profiles
|
||||
|
||||
|
||||
bindsym $mod+Shift+m exec ~/.config/i3/scripts/restore-idols-monitor.sh
|
||||
|
||||
@@ -270,7 +263,6 @@ exec --no-startup-id xset s 480 dpms 600 600 600
|
||||
#exec --no-startup-id /usr/bin/dunst --config ~/.config/dunst/dunstrc
|
||||
exec --no-startup-id /usr/bin/dunst
|
||||
|
||||
|
||||
# screenshot tool
|
||||
exec --no-startup-id flameshot
|
||||
|
||||
@@ -280,8 +272,6 @@ exec_always --no-startup-id autotiling
|
||||
|
||||
exec --no-startup-id i3-msg "workspace $ws2; exec firefox"
|
||||
|
||||
exec --no-startup-id sleep 1 && ~/.config/i3/scripts/restore-idols-monitor.sh
|
||||
|
||||
##################
|
||||
# floating rules #
|
||||
##################
|
||||
@@ -306,9 +296,8 @@ for_window [class="urxvt"] border pixel 1
|
||||
# set position of floating window
|
||||
#for_window [class=".*"] move position center
|
||||
|
||||
|
||||
######################################
|
||||
# color settings for bar and windows #
|
||||
# color settings for windows #
|
||||
######################################
|
||||
|
||||
# https://github.com/catppuccin/i3/blob/main/themes/catppuccin-mocha
|
||||
@@ -336,7 +325,6 @@ set $surface1 #45475a
|
||||
set $surface0 #313244
|
||||
set $base #1e1e2e
|
||||
# use colors in the RGBA format, the last two digits are transparency
|
||||
set $base_i3bar #1e1e2ee6
|
||||
set $mantle #181825
|
||||
set $crust #11111b
|
||||
|
||||
@@ -348,40 +336,8 @@ client.urgent $pink $base $lavender $overlay0 $pink
|
||||
client.placeholder $overlay0 $base $text $overlay0 $overlay0
|
||||
client.background $base
|
||||
|
||||
|
||||
############################################
|
||||
# bar settings (input comes from i3blocks) #
|
||||
############################################
|
||||
|
||||
# Start i3bar to display a workspace bar
|
||||
# (plus the system information i3status finds out, if available)
|
||||
bar {
|
||||
font pango: Noto Sans Regular 10
|
||||
status_command i3blocks -c ~/.config/i3/i3blocks.conf
|
||||
position top
|
||||
|
||||
# it could be that you have no primary display set: set one (xrandr --output <output> --primary)
|
||||
# reference: https://i3wm.org/docs/userguide.html#_tray_output
|
||||
tray_output primary
|
||||
tray_padding 0
|
||||
|
||||
# When strip_workspace_numbers is set to yes,
|
||||
# any workspace that has a name of the form
|
||||
# “[n][:][NAME]” will display only the name.
|
||||
strip_workspace_numbers yes
|
||||
##strip_workspace_name no
|
||||
|
||||
colors {
|
||||
separator $pink
|
||||
background $base_transparent
|
||||
statusline $lavender
|
||||
# border bg txt indicator
|
||||
focused_workspace $surface2 $overlay1 $surface1 $pink
|
||||
active_workspace $peach $surface2 $surface1 $pink
|
||||
inactive_workspace $surface1 $surface2 $overlay1 $pink
|
||||
urgent_workspace $red $red $lavender $pink
|
||||
}
|
||||
}
|
||||
# Start Polybar
|
||||
exec_always --no-startup-id $HOME/.config/polybar/launch.sh --shapes
|
||||
|
||||
#####################################
|
||||
# Application menu handled by rofi: #
|
||||
|
||||
@@ -1,142 +0,0 @@
|
||||
#
|
||||
# _ _____ _ _ _
|
||||
# (_)___ /| |__ | | ___ ___| | _____
|
||||
# | | |_ \| '_ \| |/ _ \ / __| |/ / __|
|
||||
# | |___) | |_) | | (_) | (__| <\__ \
|
||||
# |_|____/|_.__/|_|\___/ \___|_|\_\___/
|
||||
#
|
||||
# Official repository for community contributed blocklets:
|
||||
# https://github.com/vivien/i3blocks-contrib
|
||||
#
|
||||
# NOTE: every command's ouput should end with a newline character (\n), otherwise the block may not be displayed correctly.
|
||||
|
||||
# Global properties
|
||||
# The top properties below are applied to every block, but can be overridden.
|
||||
separator=false
|
||||
markup=pango
|
||||
|
||||
[terminal]
|
||||
full_text=
|
||||
color=#807dfe
|
||||
command=i3-msg -q exec kitty
|
||||
|
||||
[browser]
|
||||
full_text=
|
||||
color=#ff7f81
|
||||
command=i3-msg -q exec firefox
|
||||
|
||||
[files]
|
||||
full_text=
|
||||
color=#7f3fbf
|
||||
command=i3-msg -q exec thunar ~/
|
||||
|
||||
[simple-2]
|
||||
full_text=: :
|
||||
color=#717171
|
||||
|
||||
|
||||
# Disk usage
|
||||
#
|
||||
# The directory defaults to $HOME if the instance is not specified.
|
||||
# The script may be called with a optional argument to set the alert
|
||||
# (defaults to 10 for 10%).
|
||||
[disk]
|
||||
command=df -h / | awk '/\//{ printf(" %4s/%s \n", $4, $2) }'
|
||||
interval=30
|
||||
label=<span color="#50fa7b"> </span>
|
||||
border=#50fa7b
|
||||
border_top=1
|
||||
border_right=0
|
||||
border_bottom=0
|
||||
border_left=0
|
||||
|
||||
|
||||
# Memory usage
|
||||
#
|
||||
# The type defaults to "mem" if the instance is not specified.
|
||||
[memory]
|
||||
command=free -h | awk '/Mem:/ { printf(" %5s/%s \n", $3, $2) }'
|
||||
interval=2
|
||||
label=<span color="#f1fa8c"> </span>
|
||||
border=#f1fa8c
|
||||
border_top=1
|
||||
border_right=0
|
||||
border_bottom=0
|
||||
border_left=0
|
||||
|
||||
[cpu_stats]
|
||||
command=(mpstat 1 1 | grep Average | awk '{ printf "%04.1f<span color=\"#ff5555\">%</span>", (100 - $12) }') && (sensors | grep 'Package id 0:\|Tdie' | grep ':[ ]*+[0-9]*.[0-9]*' -o | awk '{ printf "%s<span color=\"#ff5555\">°C</span>\n", $2 }')
|
||||
interval=2
|
||||
label=<span color="#ff5555"><b>CPU: </b></span>
|
||||
border=#ff5555
|
||||
border_top=1
|
||||
border_right=0
|
||||
border_bottom=0
|
||||
border_left=0
|
||||
|
||||
|
||||
[nvidia_gpu_stats]
|
||||
command=nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader,nounits | awk '{ printf "%02i<span color=\"#ffb86c\">%</span>", $0}' && nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader,nounits | awk '{ printf "+%i<span color=\"#ffb86c\">°C</span>\n", $0}'
|
||||
label=<span color="#ffb86c"><b>GPU: </b></span>
|
||||
interval=5
|
||||
border=#ffb86c
|
||||
border_top=1
|
||||
border_right=0
|
||||
border_bottom=0
|
||||
border_left=0
|
||||
|
||||
|
||||
# https://github.com/vivien/i3blocks-contrib/blob/master/bandwidth3/README.md
|
||||
[bandwidth]
|
||||
command=~/.config/i3/scripts/bandwidth
|
||||
label=<span color="#ff79c6"></span>
|
||||
interval=persist
|
||||
border=#ff79c6
|
||||
border_top=1
|
||||
border_right=0
|
||||
border_bottom=0
|
||||
border_left=0
|
||||
|
||||
|
||||
[pavucontrol]
|
||||
full_text=
|
||||
command=pavucontrol
|
||||
border=#ffffff
|
||||
border_top=1
|
||||
border_right=0
|
||||
border_bottom=0
|
||||
border_left=0
|
||||
|
||||
|
||||
[date]
|
||||
command=date
|
||||
interval=60
|
||||
label=<span color="#ff5555"> </span>
|
||||
border=#ff5555
|
||||
border_top=1
|
||||
border_right=0
|
||||
border_bottom=0
|
||||
border_left=0
|
||||
|
||||
|
||||
# power-profiles-daemon implementation:
|
||||
# needs package power-profiles-daemon installed and the service running see here:
|
||||
# https://wiki.archlinux.org/title/CPU_frequency_scaling#power-profiles-daemon
|
||||
[ppd_menu]
|
||||
full_text=
|
||||
command=~/.config/i3/scripts/power-profiles
|
||||
color=#50fa7b
|
||||
|
||||
#Show the current power-profile
|
||||
[ppd-status]
|
||||
command=powerprofilesctl get
|
||||
interval=5
|
||||
|
||||
|
||||
[shutdown_menu]
|
||||
full_text=
|
||||
command=~/.config/i3/scripts/powermenu
|
||||
|
||||
[simple-2]
|
||||
full_text=: :
|
||||
color=#717171
|
||||
@@ -1,15 +0,0 @@
|
||||
# I3 Layouts
|
||||
|
||||
This directory contains the layouts for i3.
|
||||
|
||||
The are generated using the `i3-save-tree` command, and need to customized to make it work.
|
||||
|
||||
See the [i3 user guide](https://i3wm.org/docs/layout-saving.html) for more information.
|
||||
|
||||
## Idol's Monitor
|
||||
|
||||
the `idol-monitor.json` file contains the layout showing my nix distributed building monitor, it's a 2x2 grid of terminals running `btop`:
|
||||
|
||||

|
||||
|
||||
the layout & btop are autostarted by i3.
|
||||
@@ -1,116 +0,0 @@
|
||||
// vim:ts=4:sw=4:et
|
||||
{
|
||||
// splitv split container with 2 children
|
||||
"border": "pixel",
|
||||
"floating": "auto_off",
|
||||
"layout": "splitv",
|
||||
"marks": [],
|
||||
"percent": 0.5,
|
||||
"type": "con",
|
||||
"nodes": [
|
||||
{
|
||||
"border": "pixel",
|
||||
"current_border_width": 2,
|
||||
"floating": "auto_off",
|
||||
"geometry": {
|
||||
"height": 600,
|
||||
"width": 800,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"marks": [],
|
||||
"name": "Alacritty",
|
||||
"percent": 0.5,
|
||||
"swallows": [
|
||||
{
|
||||
"class": "^Alacritty$",
|
||||
"instance": "^Alacritty$",
|
||||
"machine": "^ai$",
|
||||
"title": "^ai$"
|
||||
}
|
||||
],
|
||||
"type": "con"
|
||||
},
|
||||
{
|
||||
"border": "pixel",
|
||||
"current_border_width": 2,
|
||||
"floating": "auto_off",
|
||||
"geometry": {
|
||||
"height": 600,
|
||||
"width": 800,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"marks": [],
|
||||
"name": "Alacritty",
|
||||
"percent": 0.5,
|
||||
"swallows": [
|
||||
{
|
||||
"class": "^Alacritty$",
|
||||
"instance": "^Alacritty$",
|
||||
"machine": "^ai$",
|
||||
"title": "^ruby$"
|
||||
}
|
||||
],
|
||||
"type": "con"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
{
|
||||
// splitv split container with 2 children
|
||||
"border": "pixel",
|
||||
"floating": "auto_off",
|
||||
"layout": "splitv",
|
||||
"marks": [],
|
||||
"percent": 0.5,
|
||||
"type": "con",
|
||||
"nodes": [
|
||||
{
|
||||
"border": "pixel",
|
||||
"current_border_width": 2,
|
||||
"floating": "auto_off",
|
||||
"geometry": {
|
||||
"height": 600,
|
||||
"width": 800,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"marks": [],
|
||||
"name": "Alacritty",
|
||||
"percent": 0.5,
|
||||
"swallows": [
|
||||
{
|
||||
"class": "^Alacritty$",
|
||||
"instance": "^Alacritty$",
|
||||
"machine": "^ai$",
|
||||
"title": "^aquamarine$"
|
||||
}
|
||||
],
|
||||
"type": "con"
|
||||
},
|
||||
{
|
||||
"border": "pixel",
|
||||
"current_border_width": 2,
|
||||
"floating": "auto_off",
|
||||
"geometry": {
|
||||
"height": 600,
|
||||
"width": 800,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"marks": [],
|
||||
"name": "Alacritty",
|
||||
"percent": 0.5,
|
||||
"swallows": [
|
||||
{
|
||||
"class": "^Alacritty$",
|
||||
"instance": "^Alacritty$",
|
||||
"machine": "^ai$",
|
||||
"title": "^kana$"
|
||||
}
|
||||
],
|
||||
"type": "con"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/*******************************************************
|
||||
* ROFI Arc Dark colors for EndeavourOS
|
||||
* Maintainer: joekamprad <joekamprad@endeavouros.com>
|
||||
*******************************************************/
|
||||
* {
|
||||
selected-normal-foreground: rgba ( 249, 249, 249, 100 % );
|
||||
foreground: rgba ( 196, 203, 212, 100 % );
|
||||
normal-foreground: @foreground;
|
||||
alternate-normal-background: rgba ( 64, 69, 82, 59 % );
|
||||
red: rgba ( 220, 50, 47, 100 % );
|
||||
selected-urgent-foreground: rgba ( 249, 249, 249, 100 % );
|
||||
blue: rgba ( 38, 139, 210, 100 % );
|
||||
urgent-foreground: rgba ( 204, 102, 102, 100 % );
|
||||
alternate-urgent-background: rgba ( 75, 81, 96, 90 % );
|
||||
active-foreground: rgba ( 101, 172, 255, 100 % );
|
||||
lightbg: rgba ( 238, 232, 213, 100 % );
|
||||
selected-active-foreground: rgba ( 249, 249, 249, 100 % );
|
||||
alternate-active-background: rgba ( 75, 81, 96, 89 % );
|
||||
background: rgba ( 45, 48, 59, 95 % );
|
||||
alternate-normal-foreground: @foreground;
|
||||
normal-background: @background;
|
||||
lightfg: rgba ( 88, 104, 117, 100 % );
|
||||
selected-normal-background: rgba ( 64, 132, 214, 100 % );
|
||||
border-color: rgba ( 124, 131, 137, 100 % );
|
||||
spacing: 2;
|
||||
separatorcolor: rgba ( 29, 31, 33, 100 % );
|
||||
urgent-background: rgba ( 29, 31, 33, 17 % );
|
||||
selected-urgent-background: rgba ( 165, 66, 66, 100 % );
|
||||
alternate-urgent-foreground: @urgent-foreground;
|
||||
background-color: rgba ( 0, 0, 0, 0 % );
|
||||
alternate-active-foreground: @active-foreground;
|
||||
active-background: rgba ( 29, 31, 33, 17 % );
|
||||
selected-active-background: rgba ( 68, 145, 237, 100 % );
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/*******************************************************
|
||||
* ROFI Arch Dark Transparent colors for EndeavourOS
|
||||
* Maintainer: joekamprad <joekamprad@endeavouros.com>
|
||||
*******************************************************/
|
||||
* {
|
||||
selected-normal-foreground: rgba ( 255, 147, 5, 100 % );
|
||||
foreground: rgba ( 196, 203, 212, 100 % );
|
||||
normal-foreground: @foreground;
|
||||
alternate-normal-background: rgba ( 45, 48, 59, 1 % );
|
||||
red: rgba ( 220, 50, 47, 100 % );
|
||||
selected-urgent-foreground: rgba ( 249, 249, 249, 100 % );
|
||||
blue: rgba ( 38, 139, 210, 100 % );
|
||||
urgent-foreground: rgba ( 204, 102, 102, 100 % );
|
||||
alternate-urgent-background: rgba ( 75, 81, 96, 90 % );
|
||||
active-foreground: rgba ( 101, 172, 255, 100 % );
|
||||
lightbg: rgba ( 238, 232, 213, 100 % );
|
||||
selected-active-foreground: rgba ( 249, 249, 249, 100 % );
|
||||
alternate-active-background: rgba ( 45, 48, 59, 88 % );
|
||||
background: rgba ( 45, 48, 59, 88 % );
|
||||
alternate-normal-foreground: @foreground;
|
||||
normal-background: rgba ( 45, 48, 59, 1 % );
|
||||
lightfg: rgba ( 88, 104, 117, 100 % );
|
||||
selected-normal-background: rgba ( 24, 26, 32, 100 % );
|
||||
border-color: rgba ( 124, 131, 137, 100 % );
|
||||
spacing: 2;
|
||||
separatorcolor: rgba ( 45, 48, 59, 1 % );
|
||||
urgent-background: rgba ( 45, 48, 59, 15 % );
|
||||
selected-urgent-background: rgba ( 165, 66, 66, 100 % );
|
||||
alternate-urgent-foreground: @urgent-foreground;
|
||||
background-color: rgba ( 0, 0, 0, 0 % );
|
||||
alternate-active-foreground: @active-foreground;
|
||||
active-background: rgba ( 29, 31, 33, 17 % );
|
||||
selected-active-background: rgba ( 26, 28, 35, 100 % );
|
||||
}
|
||||
@@ -1,121 +0,0 @@
|
||||
/*******************************************************
|
||||
* ROFI configs i3 powermenu for EndeavourOS
|
||||
* Maintainer: joekamprad <joekamprad@endeavouros.com>
|
||||
*******************************************************/
|
||||
configuration {
|
||||
font: "Noto Sans Regular 10";
|
||||
show-icons: false;
|
||||
icon-theme: "Qogir";
|
||||
scroll-method: 0;
|
||||
disable-history: false;
|
||||
fullscreen: false;
|
||||
hide-scrollbar: true;
|
||||
sidebar-mode: false;
|
||||
}
|
||||
|
||||
@import "~/.config/rofi/arc_dark_colors.rasi"
|
||||
|
||||
|
||||
window {
|
||||
background-color: @background;
|
||||
border: 0;
|
||||
padding: 10;
|
||||
transparency: "real";
|
||||
width: 170px;
|
||||
location: east;
|
||||
/*y-offset: 18;*/
|
||||
/*x-offset: 850;*/
|
||||
}
|
||||
listview {
|
||||
lines: 4;
|
||||
columns: 1;
|
||||
}
|
||||
element {
|
||||
border: 0;
|
||||
padding: 1px;
|
||||
}
|
||||
element-text {
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
element.normal.normal {
|
||||
background-color: @normal-background;
|
||||
text-color: @normal-foreground;
|
||||
}
|
||||
element.normal.urgent {
|
||||
background-color: @urgent-background;
|
||||
text-color: @urgent-foreground;
|
||||
}
|
||||
element.normal.active {
|
||||
background-color: @active-background;
|
||||
text-color: @active-foreground;
|
||||
}
|
||||
element.selected.normal {
|
||||
background-color: @selected-normal-background;
|
||||
text-color: @selected-normal-foreground;
|
||||
}
|
||||
element.selected.urgent {
|
||||
background-color: @selected-urgent-background;
|
||||
text-color: @selected-urgent-foreground;
|
||||
}
|
||||
element.selected.active {
|
||||
background-color: @selected-active-background;
|
||||
text-color: @selected-active-foreground;
|
||||
}
|
||||
element.alternate.normal {
|
||||
background-color: @alternate-normal-background;
|
||||
text-color: @alternate-normal-foreground;
|
||||
}
|
||||
element.alternate.urgent {
|
||||
background-color: @alternate-urgent-background;
|
||||
text-color: @alternate-urgent-foreground;
|
||||
}
|
||||
element.alternate.active {
|
||||
background-color: @alternate-active-background;
|
||||
text-color: @alternate-active-foreground;
|
||||
}
|
||||
scrollbar {
|
||||
width: 4px;
|
||||
border: 0;
|
||||
handle-color: @normal-foreground;
|
||||
handle-width: 8px;
|
||||
padding: 0;
|
||||
}
|
||||
mode-switcher {
|
||||
border: 2px 0px 0px;
|
||||
border-color: @separatorcolor;
|
||||
}
|
||||
button {
|
||||
spacing: 0;
|
||||
text-color: @normal-foreground;
|
||||
}
|
||||
button.selected {
|
||||
background-color: @selected-normal-background;
|
||||
text-color: @selected-normal-foreground;
|
||||
}
|
||||
inputbar {
|
||||
spacing: 0;
|
||||
text-color: @normal-foreground;
|
||||
padding: 1px;
|
||||
}
|
||||
case-indicator {
|
||||
spacing: 0;
|
||||
text-color: @normal-foreground;
|
||||
}
|
||||
entry {
|
||||
spacing: 0;
|
||||
text-color: @normal-foreground;
|
||||
}
|
||||
prompt {
|
||||
spacing: 0;
|
||||
text-color: @normal-foreground;
|
||||
}
|
||||
inputbar {
|
||||
children: [ prompt,textbox-prompt-colon,entry,case-indicator ];
|
||||
}
|
||||
textbox-prompt-colon {
|
||||
expand: false;
|
||||
str: "Set Power Profile:";
|
||||
margin: 0px 0.3em 0em 0em;
|
||||
text-color: @normal-foreground;
|
||||
}
|
||||
@@ -1,124 +0,0 @@
|
||||
/*******************************************************
|
||||
* ROFI configs i3 powermenu for EndeavourOS
|
||||
* Maintainer: joekamprad <joekamprad@endeavouros.com>
|
||||
*******************************************************/
|
||||
configuration {
|
||||
font: "Noto Sans Regular 10";
|
||||
show-icons: false;
|
||||
icon-theme: "Qogir";
|
||||
scroll-method: 0;
|
||||
disable-history: false;
|
||||
sidebar-mode: false;
|
||||
}
|
||||
|
||||
@import "~/.config/rofi/arc_dark_transparent_colors.rasi"
|
||||
|
||||
window {
|
||||
background-color: @background;
|
||||
border: 0;
|
||||
padding: 10;
|
||||
transparency: "real";
|
||||
width: 120px;
|
||||
location: east;
|
||||
/*y-offset: 18;*/
|
||||
/*x-offset: 850;*/
|
||||
}
|
||||
listview {
|
||||
lines: 7;
|
||||
columns: 1;
|
||||
scrollbar: false;
|
||||
}
|
||||
element {
|
||||
border: 0;
|
||||
padding: 1px;
|
||||
}
|
||||
element-text {
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
element.normal.normal {
|
||||
background-color: @normal-background;
|
||||
text-color: @normal-foreground;
|
||||
}
|
||||
element.normal.urgent {
|
||||
background-color: @urgent-background;
|
||||
text-color: @urgent-foreground;
|
||||
}
|
||||
element.normal.active {
|
||||
background-color: @active-background;
|
||||
text-color: @active-foreground;
|
||||
}
|
||||
element.selected.normal {
|
||||
background-color: @selected-normal-background;
|
||||
text-color: @selected-normal-foreground;
|
||||
}
|
||||
element.selected.urgent {
|
||||
background-color: @selected-urgent-background;
|
||||
text-color: @selected-urgent-foreground;
|
||||
}
|
||||
element.selected.active {
|
||||
background-color: @selected-active-background;
|
||||
text-color: @selected-active-foreground;
|
||||
}
|
||||
element.alternate.normal {
|
||||
background-color: @alternate-normal-background;
|
||||
text-color: @alternate-normal-foreground;
|
||||
}
|
||||
element.alternate.urgent {
|
||||
background-color: @alternate-urgent-background;
|
||||
text-color: @alternate-urgent-foreground;
|
||||
}
|
||||
element.alternate.active {
|
||||
background-color: @alternate-active-background;
|
||||
text-color: @alternate-active-foreground;
|
||||
}
|
||||
scrollbar {
|
||||
width: 4px;
|
||||
border: 0;
|
||||
handle-color: @normal-foreground;
|
||||
handle-width: 8px;
|
||||
padding: 0;
|
||||
}
|
||||
mode-switcher {
|
||||
border: 2px 0px 0px;
|
||||
border-color: @separatorcolor;
|
||||
}
|
||||
button {
|
||||
spacing: 0;
|
||||
text-color: @normal-foreground;
|
||||
}
|
||||
button.selected {
|
||||
background-color: @selected-normal-background;
|
||||
text-color: @selected-normal-foreground;
|
||||
}
|
||||
inputbar {
|
||||
spacing: 0;
|
||||
text-color: @normal-foreground;
|
||||
padding: 1px;
|
||||
}
|
||||
case-indicator {
|
||||
spacing: 0;
|
||||
text-color: @normal-foreground;
|
||||
}
|
||||
entry {
|
||||
spacing: 0;
|
||||
text-color: @normal-foreground;
|
||||
}
|
||||
prompt {
|
||||
spacing: 0;
|
||||
text-color: @normal-foreground;
|
||||
}
|
||||
inputbar {
|
||||
children: [ prompt,textbox-prompt-colon,entry,case-indicator ];
|
||||
}
|
||||
textbox-prompt-colon {
|
||||
expand: false;
|
||||
str: ":";
|
||||
margin: 0px 0.3em 0em 0em;
|
||||
text-color: @normal-foreground;
|
||||
}
|
||||
|
||||
/*removes the text input line*/
|
||||
mainbox {
|
||||
children: [listview];
|
||||
}
|
||||
@@ -1,135 +0,0 @@
|
||||
/*******************************************************
|
||||
* ROFI configs i3 Apps menu for EndeavourOS
|
||||
* Maintainer: joekamprad <joekamprad@endeavouros.com>
|
||||
*******************************************************/
|
||||
configuration {
|
||||
font: "Noto Sans Regular 10";
|
||||
show-icons: true;
|
||||
icon-theme: "Qogir";
|
||||
display-drun: "Apps";
|
||||
drun-display-format: "{name}";
|
||||
scroll-method: 0;
|
||||
disable-history: false;
|
||||
sidebar-mode: false;
|
||||
}
|
||||
|
||||
@import "~/.config/rofi/arc_dark_transparent_colors.rasi"
|
||||
|
||||
window {
|
||||
background-color: @background;
|
||||
border: 0;
|
||||
padding: 30;
|
||||
}
|
||||
listview {
|
||||
lines: 10;
|
||||
columns: 3;
|
||||
}
|
||||
mainbox {
|
||||
border: 0;
|
||||
padding: 0;
|
||||
}
|
||||
message {
|
||||
border: 2px 0px 0px;
|
||||
border-color: @separatorcolor;
|
||||
padding: 1px;
|
||||
}
|
||||
textbox {
|
||||
text-color: @foreground;
|
||||
}
|
||||
listview {
|
||||
fixed-height: 0;
|
||||
border: 8px 0px 0px;
|
||||
border-color: @separatorcolor;
|
||||
spacing: 8px;
|
||||
scrollbar: false;
|
||||
padding: 2px 0px 0px;
|
||||
}
|
||||
element {
|
||||
border: 0;
|
||||
padding: 1px;
|
||||
}
|
||||
element-text {
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
element.normal.normal {
|
||||
background-color: @normal-background;
|
||||
text-color: @normal-foreground;
|
||||
}
|
||||
element.normal.urgent {
|
||||
background-color: @urgent-background;
|
||||
text-color: @urgent-foreground;
|
||||
}
|
||||
element.normal.active {
|
||||
background-color: @active-background;
|
||||
text-color: @active-foreground;
|
||||
}
|
||||
element.selected.normal {
|
||||
background-color: @selected-normal-background;
|
||||
text-color: @selected-normal-foreground;
|
||||
}
|
||||
element.selected.urgent {
|
||||
background-color: @selected-urgent-background;
|
||||
text-color: @selected-urgent-foreground;
|
||||
}
|
||||
element.selected.active {
|
||||
background-color: @selected-active-background;
|
||||
text-color: @selected-active-foreground;
|
||||
}
|
||||
element.alternate.normal {
|
||||
background-color: @alternate-normal-background;
|
||||
text-color: @alternate-normal-foreground;
|
||||
}
|
||||
element.alternate.urgent {
|
||||
background-color: @alternate-urgent-background;
|
||||
text-color: @alternate-urgent-foreground;
|
||||
}
|
||||
element.alternate.active {
|
||||
background-color: @alternate-active-background;
|
||||
text-color: @alternate-active-foreground;
|
||||
}
|
||||
scrollbar {
|
||||
width: 4px;
|
||||
border: 0;
|
||||
handle-color: @normal-foreground;
|
||||
handle-width: 8px;
|
||||
padding: 0;
|
||||
}
|
||||
mode-switcher {
|
||||
border: 2px 0px 0px;
|
||||
border-color: @separatorcolor;
|
||||
}
|
||||
button {
|
||||
spacing: 0;
|
||||
text-color: @normal-foreground;
|
||||
}
|
||||
button.selected {
|
||||
background-color: @selected-normal-background;
|
||||
text-color: @selected-normal-foreground;
|
||||
}
|
||||
inputbar {
|
||||
spacing: 0;
|
||||
text-color: @normal-foreground;
|
||||
padding: 1px;
|
||||
}
|
||||
case-indicator {
|
||||
spacing: 0;
|
||||
text-color: @normal-foreground;
|
||||
}
|
||||
entry {
|
||||
spacing: 0;
|
||||
text-color: @normal-foreground;
|
||||
}
|
||||
prompt {
|
||||
spacing: 0;
|
||||
text-color: @normal-foreground;
|
||||
}
|
||||
inputbar {
|
||||
children: [ prompt,textbox-prompt-colon,entry,case-indicator ];
|
||||
}
|
||||
textbox-prompt-colon {
|
||||
expand: false;
|
||||
str: ":";
|
||||
margin: 0px 0.3em 0em 0em;
|
||||
text-color: @normal-foreground;
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
/*******************************************************
|
||||
* ROFI configs i3 keyhint-menu for EndeavourOS
|
||||
* Maintainer: joekamprad <joekamprad@endeavouros.com>
|
||||
*******************************************************/
|
||||
configuration {
|
||||
font: "Noto Sans Regular 10";
|
||||
show-icons: false;
|
||||
icon-theme: "Qogir";
|
||||
display-drun: "KeyHint";
|
||||
drun-display-format: "{name}";
|
||||
scroll-method: 0;
|
||||
disable-history: false;
|
||||
fullscreen: false;
|
||||
hide-scrollbar: true;
|
||||
sidebar-mode: false;
|
||||
}
|
||||
|
||||
@import "~/.config/rofi/arc_dark_transparent_colors.rasi"
|
||||
|
||||
window {
|
||||
background-color: @background;
|
||||
border: 0;
|
||||
padding: 30;
|
||||
}
|
||||
listview {
|
||||
lines: 10;
|
||||
columns: 1;
|
||||
}
|
||||
mainbox {
|
||||
border: 0;
|
||||
padding: 0;
|
||||
}
|
||||
message {
|
||||
border: 2px 0px 0px;
|
||||
border-color: @separatorcolor;
|
||||
padding: 1px;
|
||||
}
|
||||
textbox {
|
||||
text-color: @foreground;
|
||||
}
|
||||
listview {
|
||||
fixed-height: 0;
|
||||
border: 8px 0px 0px;
|
||||
border-color: @separatorcolor;
|
||||
spacing: 8px;
|
||||
scrollbar: false;
|
||||
padding: 2px 0px 0px;
|
||||
}
|
||||
element {
|
||||
border: 0;
|
||||
padding: 1px;
|
||||
}
|
||||
element-text {
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
element.normal.normal {
|
||||
background-color: @normal-background;
|
||||
text-color: @normal-foreground;
|
||||
}
|
||||
element.normal.urgent {
|
||||
background-color: @urgent-background;
|
||||
text-color: @urgent-foreground;
|
||||
}
|
||||
element.normal.active {
|
||||
background-color: @active-background;
|
||||
text-color: @active-foreground;
|
||||
}
|
||||
element.selected.normal {
|
||||
background-color: @selected-normal-background;
|
||||
text-color: @selected-normal-foreground;
|
||||
}
|
||||
element.selected.urgent {
|
||||
background-color: @selected-urgent-background;
|
||||
text-color: @selected-urgent-foreground;
|
||||
}
|
||||
element.selected.active {
|
||||
background-color: @selected-active-background;
|
||||
text-color: @selected-active-foreground;
|
||||
}
|
||||
element.alternate.normal {
|
||||
background-color: @alternate-normal-background;
|
||||
text-color: @alternate-normal-foreground;
|
||||
}
|
||||
element.alternate.urgent {
|
||||
background-color: @alternate-urgent-background;
|
||||
text-color: @alternate-urgent-foreground;
|
||||
}
|
||||
element.alternate.active {
|
||||
background-color: @alternate-active-background;
|
||||
text-color: @alternate-active-foreground;
|
||||
}
|
||||
scrollbar {
|
||||
width: 4px;
|
||||
border: 0;
|
||||
handle-color: @normal-foreground;
|
||||
handle-width: 8px;
|
||||
padding: 0;
|
||||
}
|
||||
mode-switcher {
|
||||
border: 2px 0px 0px;
|
||||
border-color: @separatorcolor;
|
||||
}
|
||||
button {
|
||||
spacing: 0;
|
||||
text-color: @normal-foreground;
|
||||
}
|
||||
button.selected {
|
||||
background-color: @selected-normal-background;
|
||||
text-color: @selected-normal-foreground;
|
||||
}
|
||||
inputbar {
|
||||
spacing: 0;
|
||||
text-color: @normal-foreground;
|
||||
padding: 1px;
|
||||
}
|
||||
case-indicator {
|
||||
spacing: 0;
|
||||
text-color: @normal-foreground;
|
||||
}
|
||||
entry {
|
||||
spacing: 0;
|
||||
text-color: @normal-foreground;
|
||||
}
|
||||
prompt {
|
||||
spacing: 0;
|
||||
text-color: @normal-foreground;
|
||||
}
|
||||
inputbar {
|
||||
children: [ prompt,textbox-prompt-colon,entry,case-indicator ];
|
||||
}
|
||||
textbox-prompt-colon {
|
||||
expand: false;
|
||||
str: ":";
|
||||
margin: 0px 0.3em 0em 0em;
|
||||
text-color: @normal-foreground;
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (C) 2015 James Murphy
|
||||
# Licensed under the terms of the GNU GPL v2 only.
|
||||
#
|
||||
# i3blocks blocklet script to monitor bandwidth usage
|
||||
|
||||
iface="${BLOCK_INSTANCE}"
|
||||
iface="${IFACE:-$iface}"
|
||||
dt="${DT:-3}"
|
||||
unit="${UNIT:-Mb}"
|
||||
printf_command="${PRINTF_COMMAND:-"printf \" %-5.1f/%5.1f %s/s\\n\", rx, wx, unit;"}"
|
||||
|
||||
function default_interface {
|
||||
ip route | awk '/^default via/ {print $5; exit}'
|
||||
}
|
||||
|
||||
function check_proc_net_dev {
|
||||
if [ ! -f "/proc/net/dev" ]; then
|
||||
echo "/proc/net/dev not found"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function list_interfaces {
|
||||
check_proc_net_dev
|
||||
echo "Interfaces in /proc/net/dev:"
|
||||
grep -o "^[^:]\\+:" /proc/net/dev | tr -d " :"
|
||||
}
|
||||
|
||||
while getopts i:t:u:p:lh opt; do
|
||||
case "$opt" in
|
||||
i) iface="$OPTARG" ;;
|
||||
t) dt="$OPTARG" ;;
|
||||
u) unit="$OPTARG" ;;
|
||||
p) printf_command="$OPTARG" ;;
|
||||
l) list_interfaces && exit 0 ;;
|
||||
h) printf \
|
||||
"Usage: bandwidth3 [-i interface] [-t time] [-u unit] [-p printf_command] [-l] [-h]
|
||||
Options:
|
||||
-i\tNetwork interface to measure. Default determined using \`ip route\`.
|
||||
-t\tTime interval in seconds between measurements. Default: 3
|
||||
-u\tUnits to measure bytes in. Default: Mb
|
||||
\tAllowed units: Kb, KB, Mb, MB, Gb, GB, Tb, TB
|
||||
\tUnits may have optional it/its/yte/ytes on the end, e.g. Mbits, KByte
|
||||
-p\tAwk command to be called after a measurement is made.
|
||||
\tDefault: printf \"<span font='FontAwesome'> </span>%%-5.1f/%%5.1f %%s/s\\\\n\", rx, wx, unit;
|
||||
\tExposed variables: rx, wx, tx, unit, iface
|
||||
-l\tList available interfaces in /proc/net/dev
|
||||
-h\tShow this help text
|
||||
" && exit 0;;
|
||||
esac
|
||||
done
|
||||
|
||||
check_proc_net_dev
|
||||
|
||||
iface="${iface:-$(default_interface)}"
|
||||
while [ -z "$iface" ]; do
|
||||
echo No default interface
|
||||
sleep "$dt"
|
||||
iface=$(default_interface)
|
||||
done
|
||||
|
||||
case "$unit" in
|
||||
Kb|Kbit|Kbits) bytes_per_unit=$((1024 / 8));;
|
||||
KB|KByte|KBytes) bytes_per_unit=$((1024));;
|
||||
Mb|Mbit|Mbits) bytes_per_unit=$((1024 * 1024 / 8));;
|
||||
MB|MByte|MBytes) bytes_per_unit=$((1024 * 1024));;
|
||||
Gb|Gbit|Gbits) bytes_per_unit=$((1024 * 1024 * 1024 / 8));;
|
||||
GB|GByte|GBytes) bytes_per_unit=$((1024 * 1024 * 1024));;
|
||||
Tb|Tbit|Tbits) bytes_per_unit=$((1024 * 1024 * 1024 * 1024 / 8));;
|
||||
TB|TByte|TBytes) bytes_per_unit=$((1024 * 1024 * 1024 * 1024));;
|
||||
*) echo Bad unit "$unit" && exit 1;;
|
||||
esac
|
||||
|
||||
scalar=$((bytes_per_unit * dt))
|
||||
init_line=$(cat /proc/net/dev | grep "^[ ]*$iface:")
|
||||
if [ -z "$init_line" ]; then
|
||||
echo Interface not found in /proc/net/dev: "$iface"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
init_received=$(awk '{print $2}' <<< $init_line)
|
||||
init_sent=$(awk '{print $10}' <<< $init_line)
|
||||
|
||||
(while true; do cat /proc/net/dev; sleep "$dt"; done) |\
|
||||
stdbuf -oL grep "^[ ]*$iface:" |\
|
||||
awk -v scalar="$scalar" -v unit="$unit" -v iface="$iface" '
|
||||
BEGIN{old_received='"$init_received"';old_sent='"$init_sent"'}
|
||||
{
|
||||
received=$2
|
||||
sent=$10
|
||||
rx=(received-old_received)/scalar;
|
||||
wx=(sent-old_sent)/scalar;
|
||||
tx=rx+wr;
|
||||
old_received=received;
|
||||
old_sent=sent;
|
||||
if(rx >= 0 && wx >= 0){
|
||||
'"$printf_command"';
|
||||
fflush(stdout);
|
||||
}
|
||||
}
|
||||
'
|
||||
@@ -1,190 +0,0 @@
|
||||
#!/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/>.
|
||||
|
||||
# power-profiles-daemon implementation:
|
||||
# needs package power-profiles-daemon installed and the service running see here:
|
||||
# https://wiki.archlinux.org/title/CPU_frequency_scaling#power-profiles-daemon
|
||||
# used in i3-blocks: ~/.config/i3/i3blocks.conf together with: ~/.config/i3/scripts/ppd-status
|
||||
|
||||
|
||||
#######################################################################
|
||||
# BEGIN CONFIG #
|
||||
#######################################################################
|
||||
|
||||
# Use a custom lock script
|
||||
#LOCKSCRIPT="i3lock-extra -m pixelize"
|
||||
|
||||
# Colors: FG (foreground), BG (background), HL (highlighted)
|
||||
FG_COLOR="#bbbbbb"
|
||||
BG_COLOR="#111111"
|
||||
HLFG_COLOR="#111111"
|
||||
HLBG_COLOR="#bbbbbb"
|
||||
BORDER_COLOR="#222222"
|
||||
|
||||
# Options not related to colors
|
||||
#ROFI_TEXT=":"
|
||||
#ROFI_OPTIONS=(-width -11 -location 0 -hide-scrollbar -bw 30 -color-window "#dd310027,#dd0310027,#dd310027" -padding 5)
|
||||
#ROFI_OPTIONS=(-width -18 -location 4 -hide-scrollbar -color-window "#cc310027,#00a0009a,#cc310027" -padding 5 -font "Sourcecode Pro Regular 10, FontAwesome 9")
|
||||
ROFI_OPTIONS=(-theme ~/.config/rofi/power-profiles.rasi)
|
||||
# Zenity options
|
||||
ZENITY_TITLE="Power Profiles"
|
||||
ZENITY_TEXT="Set Profiles:"
|
||||
ZENITY_OPTIONS=(--column= --hide-header)
|
||||
|
||||
#######################################################################
|
||||
# END CONFIG #
|
||||
#######################################################################
|
||||
|
||||
# Whether to ask for user's confirmation
|
||||
enable_confirmation=false
|
||||
|
||||
# Preferred launcher if both are available
|
||||
preferred_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 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=(
|
||||
[ Performance]="powerprofilesctl set performance"
|
||||
[ Balanced]="powerprofilesctl set balanced"
|
||||
[ Power Saver]="powerprofilesctl set power-saver"
|
||||
[ 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=(-dpi 128 -dmenu -i -lines "${menu_nrows}" -p "${ROFI_TEXT}" \
|
||||
"${rofi_colors}" "${ROFI_OPTIONS[@]}")
|
||||
elif [[ "$1" == "zenity" ]]; then
|
||||
launcher_exe="zenity"
|
||||
launcher_options=(-dpi 128 --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 --no-startup-id ${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 --no-startup-id ${menu[${selection}]}"
|
||||
fi
|
||||
fi
|
||||
@@ -1,186 +0,0 @@
|
||||
#!/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/>.
|
||||
|
||||
# modified to work with latest rofi update by joekamprad <joekamprad@endeavouros.com>
|
||||
|
||||
#######################################################################
|
||||
# BEGIN CONFIG #
|
||||
#######################################################################
|
||||
|
||||
# Use a custom lock script
|
||||
#LOCKSCRIPT="i3lock-extra -m pixelize"
|
||||
|
||||
# Colors: FG (foreground), BG (background), HL (highlighted)
|
||||
FG_COLOR="#bbbbbb"
|
||||
BG_COLOR="#111111"
|
||||
HLFG_COLOR="#111111"
|
||||
HLBG_COLOR="#bbbbbb"
|
||||
BORDER_COLOR="#222222"
|
||||
|
||||
# Options not related to colors (most rofi options do not work anymore)
|
||||
ROFI_OPTIONS=(-theme ~/.config/rofi/powermenu.rasi)
|
||||
# Zenity options
|
||||
ZENITY_TITLE="Power Menu"
|
||||
ZENITY_TEXT="Action:"
|
||||
ZENITY_OPTIONS=(--column= --hide-header)
|
||||
|
||||
#######################################################################
|
||||
# END CONFIG #
|
||||
#######################################################################
|
||||
|
||||
# Whether to ask for user's confirmation
|
||||
enable_confirmation=false
|
||||
|
||||
# Preferred launcher if both are available
|
||||
preferred_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 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"
|
||||
[ Suspend]="systemctl suspend"
|
||||
[ Hibernate]="systemctl hibernate"
|
||||
[ Lock]="~/.config/i3/scripts/blur-lock"
|
||||
[ 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=(-dpi 128 -dmenu -i -lines "${menu_nrows}" -p "${ROFI_TEXT}" \
|
||||
"${rofi_colors}" "${ROFI_OPTIONS[@]}")
|
||||
elif [[ "$1" == "zenity" ]]; then
|
||||
launcher_exe="zenity"
|
||||
launcher_options=(-dpi 128 --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 --no-startup-id ${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 --no-startup-id ${menu[${selection}]}"
|
||||
fi
|
||||
fi
|
||||
@@ -1,18 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#######################################################
|
||||
#
|
||||
# This script restores the layout of the idols monitor.
|
||||
#
|
||||
#######################################################
|
||||
|
||||
# load the ssh key for idols first
|
||||
ssh-add ~/.ssh/ai-idols
|
||||
|
||||
# restore the layout of workspace 1
|
||||
i3-msg "workspace 10: ; append_layout ~/.config/i3/layouts/idols-monitor.json"
|
||||
# open applications, note that --command must be the last option
|
||||
i3-msg -t command "exec alacritty --title 'ai' --command 'btop'"
|
||||
i3-msg -t command "exec alacritty --title 'aquamarine' --command ssh -t ryan@aquamarine 'btop'"
|
||||
i3-msg -t command "exec alacritty --title 'ruby' --command ssh -t ryan@ruby 'btop'"
|
||||
i3-msg -t command "exec alacritty --title 'kana' --command ssh -t ryan@kana 'btop'"
|
||||
@@ -1,6 +1,4 @@
|
||||
_: {
|
||||
# i3 window manager's config, based on https://github.com/endeavouros-team/endeavouros-i3wm-setup
|
||||
|
||||
{pkgs, ...}: {
|
||||
# NOTE:
|
||||
# We have to enable hyprland/i3's systemd user service in home-manager,
|
||||
# so that gammastep/wallpaper-switcher's user service can be start correctly!
|
||||
@@ -17,32 +15,28 @@ _: {
|
||||
};
|
||||
|
||||
xdg.configFile = {
|
||||
"i3/i3blocks.conf".source = ../conf/i3blocks.conf;
|
||||
"i3/scripts" = {
|
||||
source = ../conf/scripts;
|
||||
# copy the scripts directory recursively
|
||||
recursive = true;
|
||||
executable = true; # make all scripts executable
|
||||
};
|
||||
"i3/layouts" = {
|
||||
source = ../conf/layouts;
|
||||
recursive = true;
|
||||
};
|
||||
# rofi is a application launcher and dmenu replacement
|
||||
"rofi" = {
|
||||
source = ../conf/rofi;
|
||||
# copy the scripts directory recursively
|
||||
recursive = true;
|
||||
};
|
||||
};
|
||||
|
||||
home.file = {
|
||||
".local/bin/bright" = {
|
||||
source = ../bin/bright;
|
||||
".config/polybar" = {
|
||||
source = "${pkgs.polybar-themes-simple}/themes";
|
||||
recursive = true;
|
||||
executable = true;
|
||||
};
|
||||
".local/bin/logout" = {
|
||||
source = ../bin/logout;
|
||||
".local/share/fonts" = {
|
||||
source = "${pkgs.polybar-themes-simple}/fonts";
|
||||
recursive = true;
|
||||
};
|
||||
|
||||
".local/bin" = {
|
||||
source = ../bin;
|
||||
recursive = true;
|
||||
executable = true;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
{pkgs, ...}: {
|
||||
home.packages = with pkgs; [
|
||||
# required by https://github.com/adi1090x/polybar-themes
|
||||
rofi # application launcher, the same as dmenu
|
||||
polybar # status bar
|
||||
pywal # generate color scheme from wallpaper
|
||||
calc
|
||||
networkmanager_dmenu # network manager
|
||||
|
||||
dunst # notification daemon
|
||||
i3blocks # status bar
|
||||
i3lock # default i3 screen locker
|
||||
xautolock # lock screen after some time
|
||||
i3status # provide information to i3bar
|
||||
i3-gaps # i3 with gaps
|
||||
picom # transparency and shadows
|
||||
feh # set wallpaper
|
||||
xcolor # color picker
|
||||
|
||||
Reference in New Issue
Block a user