Skip to content

Instantly share code, notes, and snippets.

@wainejr
Last active November 15, 2024 15:54
Show Gist options
  • Save wainejr/0564b037ed3fa02949064e3cdc98c3e3 to your computer and use it in GitHub Desktop.
Save wainejr/0564b037ed3fa02949064e3cdc98c3e3 to your computer and use it in GitHub Desktop.
Linux setup files
#!/bin/bash
# From root in repo, run
# chmod +x .config/qtile/autostart.sh
# ln -s $(pwd)/.config/qtile/autostart.sh ~/.config/qtile/autostart.sh
# to link autostart with this
# Function to check if a process is already running and run it if not
function run {
if ! pgrep -x $(basename $1 | head -c 15) 1>/dev/null;
then
$@&
fi
}
# Uncomment the following line if you need to change your keyboard layout to Hebrew (IL)
setxkbmap -layout br
#Uncomment the following line if you want to start sxhkd to replace Qtile native key-bindings
#run sxhkd -c ~/.config/qtile/sxhkd/sxhkdrc &
#starting user applications at boot time
#run google-chrome-stable &
#run volumeicon &
# run thunar & # Start Thunar file manager
# Sleep before running commands
sleep 5
run firefox &
# run code &
# Discord has 2 different names in Ubuntu (discord) and Fedora (Discord)
# command -v discord >/dev/null 2>&1 && run discord &
# command -v Discord >/dev/null 2>&1 && run Discord &
# Run blugon for blue screen filter
# run blugon &
run picom --config $HOME/.config/qtile/picom.conf &
# Set volume for Microphone to 60%, what I actually use
# pactl set-source-volume 58 70%
# Disable automute on PC for audio devices
/usr/bin/amixer -c 3 sset "Auto-Mute Mode" Disabled
# Please be cautious while adding applications to start at boot time.
# Only add applications you need on startup to avoid unnecessary resource usage.
# for notebook bug only
# bash /home/waine/Documents/pc-setup/bugs/mousepad_fix.sh >/dev/null 2>&1
# Inspirations: aron
# Copyright (c) 2010 Aldo Cortesi
# Copyright (c) 2010, 2014 dequis
# Copyright (c) 2012 Randall Ma
# Copyright (c) 2012-2014 Tycho Andersen
# Copyright (c) 2012 Craig Barnes
# Copyright (c) 2013 horsik
# Copyright (c) 2013 Tao Sauvage
#
# 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.
from libqtile import bar, layout, qtile, widget, hook
from libqtile.config import Click, Drag, Group, Key, Match, Screen, ScratchPad, DropDown
from libqtile.lazy import lazy
from libqtile.utils import guess_terminal
# Import FPDF module for generating a PDF of key bindings
from fpdf import FPDF
import os
import subprocess
import random
import shutil
import pc_spec
# @hook.subscribe.startup
# def dbus_register():
# id = os.environ.get('DESKTOP_AUTOSTART_ID')
# if not id:
# return
# subprocess.Popen(['dbus-send',
# '--session',
# '--print-reply',
# '--dest=org.gnome.SessionManager',
# '/org/gnome/SessionManager',
# 'org.gnome.SessionManager.RegisterClient',
# 'string:qtile',
# 'string:' + id])
home = os.path.expanduser("~")
floating_window_index = 0
def float_cycle(qtile, forward: bool):
global floating_window_index
floating_windows = []
for window in qtile.current_group.windows:
if window.floating:
floating_windows.append(window)
if not floating_windows:
return
floating_window_index = min(floating_window_index, len(floating_windows) - 1)
if forward:
floating_window_index += 1
else:
floating_window_index -= 1
if floating_window_index >= len(floating_windows):
floating_window_index = 0
if floating_window_index < 0:
floating_window_index = len(floating_windows) - 1
win = floating_windows[floating_window_index]
win.bring_to_front()
win.cmd_focus()
@lazy.function
def float_cycle_backward(qtile):
float_cycle(qtile, False)
@lazy.function
def float_cycle_forward(qtile):
float_cycle(qtile, True)
@lazy.function
def float_to_front(qtile):
"""
Bring all floating windows of the group to front
"""
for window in qtile.current_group.windows:
if window.floating:
window.move_to_top()
@lazy.function
def float_to_back(qtile):
"""
Bring all floating windows of the group to front
"""
for window in qtile.current_group.windows:
if window.floating:
window.move_to_bottom()
# Function to run at startup once. It is used to run commands specified in the 'autostart.sh'
@hook.subscribe.startup_once
def start_once():
subprocess.call([home + "/.config/qtile/autostart.sh"])
def open_group_on_given_screen(group_name: str, screen: float):
def _inner(qtile):
if len(qtile.screens) == 1:
qtile.groups_map[group_name].toscreen()
return
qtile.focus_screen(screen)
qtile.groups_map[group_name].toscreen()
return _inner
def close_current_group(qtile):
current_group_name = qtile.current_group.name
# Remove the current group (only if not default)
if current_group_name not in "1234qwer":
qtile.delete_group(current_group_name)
qtile.groups_map["q"].toscreen()
mod = "mod4"
# terminal = guess_terminal()
# Make sure alacritty is installed (https://github.com/alacritty/alacritty/blob/master/INSTALL.md)
terminal = "alacritty"
keys = [
# A list of available commands that can be bound to keys can be found
# at https://docs.qtile.org/en/latest/manual/config/lazy.html
# Switch between windows
Key([mod], "h", lazy.layout.left(), desc="Move focus to left"),
Key([mod], "l", lazy.layout.right(), desc="Move focus to right"),
Key([mod], "j", lazy.layout.down(), desc="Move focus down"),
Key([mod], "k", lazy.layout.up(), desc="Move focus up"),
Key([mod], "space", lazy.layout.next(), desc="Move window focus to other window"),
# Move windows between left/right columns or move up/down in current stack.
# Moving out of range in Columns layout will create new column.
Key(
[mod, "shift"], "h", lazy.layout.shuffle_left(), desc="Move window to the left"
),
Key(
[mod, "shift"],
"l",
lazy.layout.shuffle_right(),
desc="Move window to the right",
),
Key([mod, "shift"], "j", lazy.layout.shuffle_down(), desc="Move window down"),
Key([mod, "shift"], "k", lazy.layout.shuffle_up(), desc="Move window up"),
# Grow windows. If current window is on the edge of screen and direction
# will be to screen edge - window would shrink.
Key(
[mod, "control"],
"h",
lazy.layout.grow_left(),
lazy.layout.shrink_main(),
desc="Grow window to the left",
),
Key(
[mod, "control"],
"l",
lazy.layout.grow_right(),
lazy.layout.grow_main(),
desc="Grow window to the right",
),
Key(
[mod, "control"],
"j",
lazy.layout.grow_down(),
lazy.layout.shrink(),
desc="Grow window down",
),
Key(
[mod, "control"],
"k",
lazy.layout.grow_up(),
lazy.layout.grow(),
desc="Grow window up",
),
Key([mod], "n", lazy.layout.normalize(), desc="Reset all window sizes"),
# Move to the next group
Key([mod], "Right", lazy.screen.next_group(), desc="Move to next group"),
# Move to the previous group
Key([mod], "Left", lazy.screen.prev_group(), desc="Move to previous group"),
# Launches Zathura with a specific PDF file
Key(
[mod, "shift"],
"i",
lazy.spawn("setsid zathura ~/Mqtile.pdf"),
desc="Info system keybindings",
),
# Launch different rofi menus for application, commands, windows, and ssh
Key(
[mod],
"d",
lazy.spawn("rofi -show run"),
desc="Launch rofi window (commands)",
),
Key(
[mod],
"a",
lazy.spawn("rofi -show drun"),
desc="Launch rofi window (applications)",
),
Key(
[mod],
"c",
lazy.spawn("rofi -show window"),
desc="Launch rofi windows (active windows)",
),
Key([mod], "s", lazy.spawn("rofi -show ssh"), desc="Launch rofi ssh"),
# Volume control bindings (using function keys and XF86Audio keys)
Key([mod], "f10", lazy.spawn("amixer -q sset Master 5%-"), desc="Lower volume"),
Key([mod], "f11", lazy.spawn("amixer -q sset Master 5%+"), desc="Raise volume"),
Key(
[mod],
"f9",
lazy.spawn("amixer -q sset Master toggle"),
desc="Mute volume toggle",
),
Key(
[],
"XF86AudioLowerVolume",
lazy.spawn("amixer -q sset Master 5%-"),
desc="Lower volume",
),
Key(
[],
"XF86AudioRaiseVolume",
lazy.spawn("amixer -q sset Master 5%+"),
desc="Raise volume",
),
Key(
[],
"XF86AudioMute",
lazy.spawn("amixer -q sset Master toggle"),
desc="Mute volume toggle",
),
Key(
[],
"XF86AudioPlay",
lazy.spawn("playerctl play-pause"),
desc="Play/Pause player",
),
Key([], "XF86AudioNext", lazy.spawn("playerctl next"), desc="Skip to next"),
Key([], "XF86AudioPrev", lazy.spawn("playerctl previous"), desc="Skip to previous"),
# Screen light
Key(
[],
"XF86MonBrightnessUp",
lazy.spawn('brightnessctl -d "intel_backlight" set 10%+'),
desc="Increase brightness",
),
Key(
[],
"XF86MonBrightnessDown",
lazy.spawn('brightnessctl -d "intel_backlight" set 10%-'),
desc="Decrease brightness",
),
# SCREENSHOTS
Key([mod, "shift"], "s", lazy.spawn("gnome-screenshot -i"), desc="Screenshot"),
# Toggle between split and unsplit sides of stack.
# Split = all windows displayed
# Unsplit = 1 window displayed, like Max layout, but still with
# multiple stack panes
Key(
[mod],
"o",
lazy.layout.toggle_split(),
desc="Toggle between split and unsplit sides of stack",
),
Key([mod], "Return", lazy.spawn(terminal), desc="Launch terminal"),
# Toggle between different layouts as defined below
Key([mod], "Tab", lazy.next_layout(), desc="Toggle between layouts"),
Key([mod], "Escape", lazy.window.kill(), desc="Kill focused window"),
Key(
[mod],
"f",
lazy.window.toggle_fullscreen(),
desc="Toggle fullscreen on the focused window",
),
# Floating windows to front and back
Key([mod, "shift"], "t", float_to_front, desc="Floating windows to front"),
Key([mod, "control"], "t", float_to_back, desc="Floating windows to back"),
Key(
[mod],
"t",
lazy.window.toggle_floating(),
desc="Toggle floating on the focused window",
),
Key([mod, "control"], "r", lazy.reload_config(), desc="Reload the config"),
Key([mod, "control"], "q", lazy.shutdown(), desc="Shutdown Qtile"),
Key(
[mod, "control"],
"Delete",
lazy.function(close_current_group),
desc="Close current group (only if not default)",
),
]
blue_pastel = "#add8e6"
green_pastel = "#98fb98"
orange_pastel = "#ffb347"
gray_pastel = "#d3d3d3"
layout_dct = {
"col": layout.Columns(
border_focus=["#326632", "#326632"],
border_normal=["#333333", "#333333"],
border_width=2,
margin=1,
num_columns=2,
fair=True,
insert_position=1,
grow_amount=2,
),
"mon_tall": layout.MonadTall(
ratio=0.78,
change_ratio=0.01,
max_ratio=0.85,
margin=1,
border_width=2,
border_focus=["#326632", "#326632"],
border_normal=["#333333", "#333333"],
),
"max": layout.Max(),
}
layouts = list(layout_dct.values())
discord_cmd = "Discord" if shutil.which("Discord") else "discord"
groups = [
Group(
"q",
label="q-Home",
screen_affinity=1,
layouts=list(layout_dct.values()),
),
Group(
"1",
label="1-Code",
matches=[
Match(wm_class="code"),
Match(wm_class="nvim"),
Match(wm_class="vim"),
],
layouts=[layout_dct[k] for k in ["mon_tall", "max", "col"]],
screen_affinity=0,
),
Group(
"2",
label="2-Web",
matches=[
Match(role="browser"),
Match(wm_class="firefox"),
Match(wm_class="brave-browser"),
],
layouts=[layout_dct[k] for k in ["mon_tall", "max", "col"]],
screen_affinity=0,
),
Group(
"3",
label="3-Obsidian",
matches=[Match(wm_class="obsidian")],
layouts=[layout_dct[k] for k in ["max", "col", "mon_tall"]],
screen_affinity=0,
),
Group(
"4",
label="4-View",
matches=[
Match(wm_class="paraview"),
Match(wm_class="paraview_build"),
],
layouts=[layout_dct[k] for k in ["mon_tall", "max", "col"]],
screen_affinity=0,
),
ScratchPad(
name="scratchpad",
dropdowns=[
# define a drop down terminal.
# it is placed in the upper third of screen by default.
DropDown(
"spotify",
match=Match(wm_class="spotify"),
# Make sure spotify is installed through flatpak
# Found in /var/lib/flatpak/exports/share/applications/com.spotify.Client.desktop
cmd="flatpak run com.spotify.Client",
opacity=0.95,
x=0.025,
y=0.025,
height=0.95,
width=0.95,
),
DropDown(
"steam",
match=Match(wm_class="steam"),
cmd="steam",
opacity=0.98,
x=0.025,
y=0.025,
height=0.95,
width=0.95,
),
DropDown(
"Discord",
match=Match(wm_class="discord"),
cmd=f"{discord_cmd}",
opacity=0.98,
x=0.025,
y=0.025,
height=0.95,
width=0.95,
),
],
single=False,
),
]
if pc_spec.add_video_screens:
groups.extend(
[
Group(
"w",
label="w-OBS",
matches=[
Match(wm_class="obs"),
],
screen_affinity=0,
layouts=[layout_dct[k] for k in ["mon_tall", "max", "col"]],
),
Group(
"e",
label="E-Resolve",
matches=[
Match(wm_class="resolve"),
],
screen_affinity=0,
layouts=list(layout_dct.values()),
),
Group(
"r",
label="r-Capture",
matches=[
Match(wm_class="scrpy"),
Match(wm_class="easyeffects"),
],
layouts=[layout_dct[k] for k in ["mon_tall", "max", "col"]],
screen_affinity=0,
),
]
)
keys.extend(
[
# toggle visibiliy of above defined DropDown named "term"
Key([mod], "8", lazy.group["scratchpad"].dropdown_toggle("Discord")),
Key([mod], "9", lazy.group["scratchpad"].dropdown_toggle("spotify")),
Key([mod], "0", lazy.group["scratchpad"].dropdown_toggle("steam")),
]
)
for grp in groups:
if isinstance(grp, ScratchPad):
continue
keys.extend(
[
# mod + group number = switch to group
Key(
[mod],
grp.name,
lazy.function(open_group_on_given_screen(grp.name, 1)),
desc=f"Switch to group {grp.name} at screen 1",
),
Key(
[mod, "mod1"],
grp.name,
lazy.function(open_group_on_given_screen(grp.name, 0)),
desc=f"Switch to group {grp.name} at screen 0",
),
# mod + shift + group number = switch to & move focused window to group
Key(
[mod, "shift"],
grp.name,
lazy.window.togroup(grp.name, switch_group=True),
desc="Switch to & move focused window to group {}".format(grp.name),
),
# Or, use below if you prefer not to switch to that group.
# # mod + shift + group number = move focused window to group
# Key([mod, "shift"], i.name, lazy.window.togroup(i.name),
# desc="move focused window to group {}".format(i.name)),
]
)
# We call the function after we have defined the key bindings for the groups
def Mqtile_info(keys):
"""
Description:
This function takes a list of key bindings and creates a text file ('Mqtile.txt')
and a PDF file ('Mqtile.pdf') containing a formatted representation of the key bindings.
The generated files will contain the key modifiers, key, and description for each key binding.
"""
# Create the 'Mqtile.txt' file
with open("Mqtile.txt", "w") as file:
ascii_art = """WAINE CONFIG"""
file.write(ascii_art)
for key in keys:
mainK = ""
for k in key.modifiers:
p = k # the text that is simple for the user that we're putting
if k == "mod4":
p = "Super"
elif k == "mod1":
p = "Alt"
mainK += f" {p} +"
keyk = key.key
if keyk.startswith("XF86"):
keyk = keyk[4:]
add = mainK + "\t" + str(keyk) + "\t - \t\t" + str(key.desc) + "\n"
file.write(add)
file.write(ascii_art)
# Convert the 'Mqtile.txt' file to a PDF file
pdf = FPDF() # Save FPDF() class into a variable 'pdf'
pdf.add_page() # Add a page
pdf.set_font("Courier", size=13) # Set style and size of font
f = open("Mqtile.txt", "r") # Open the text file in read mode
for x in f: # Insert the texts in to the PDF
pdf.cell(200, 10, txt=x, ln=1, align="L")
pdf.output("Mqtile.pdf") # Save the PDF with name 'Mqtile.pdf'
# Call the function to generate the files with the provided keys
Mqtile_info(keys)
widget_defaults = dict(
font="Lilex Nerd Font Mono Regular",
fontsize=15,
padding=3,
)
extension_defaults = widget_defaults.copy()
font_size = pc_spec.font_size
sc_sep = widget.Sep(
linewidth=2,
padding=10,
foreground="#fcf8c0",
size_percent=65,
)
def def_screen(img_number: int):
return Screen(
top=bar.Bar(
[
# GroupBox widget to display group names and windows
widget.GroupBox(
foreground="00FF00",
highlight_method="line",
disable_drag=True,
highlight_color=[
"345763",
"004000",
], # Set the text color when selected and not selected
inactive="458b74",
fontsize=font_size + 1,
font="Noto Sans",
),
sc_sep,
# Widget to display the name of the currently focused window
widget.WindowName(
foreground="#fcf8c0",
fontsize=font_size,
font="Noto Sans",
),
widget.Spacer(),
# Clock widget to display date and time and launch Zathura on click -> open the file Mqtile.pdf -> key bindings map
widget.Clock(
format="%Y-%m-%d %a %H:%M",
foreground="#ffffff",
font="Noto Sans Bold",
mouse_callbacks={"Button1": lazy.spawn("gnome-calendar")},
fontsize=font_size,
),
widget.Spacer(),
# # Custom TextBox widget for 'Lay' (Layout) text display
# widget.TextBox(
# font="Noto Sans", text="Lay:", padding=0, fontsize=font_size
# ),
# # CurrentLayout widget to display the current layout
# widget.CurrentLayout(
# font="Noto Sans Bold",
# fontsize=font_size,
# ),
# sc_sep,
]
+ (
[
# Custom TextBox widget for 'Mem' (Memory) text display
widget.TextBox(
font="Noto Sans", text="CPU:", padding=0, fontsize=font_size
),
# Memory widget to display memory usage and launch htop on click
widget.CPU(
font="Noto Sans Bold",
format="{freq_current}GHz {load_percent:4.1f}%",
update_interval=1,
fontsize=font_size,
measure_mem="G",
),
sc_sep,
]
if pc_spec.show_cpu
else []
)
+ [
# Custom TextBox widget for 'Mem' (Memory) text display
widget.TextBox(
font="Noto Sans", text="Mem:", padding=0, fontsize=font_size
),
# Memory widget to display memory usage and launch htop on click
widget.Memory(
font="Noto Sans Bold",
format="{MemUsed:4.1f}G / {MemTotal:.1f}G",
update_interval=1,
fontsize=font_size,
measure_mem="G",
mouse_callbacks={
"Button1": lazy.spawn(f"{terminal} -e zsh -c 'htop'")
},
),
sc_sep,
]
+ (
[
# Custom TextBox widget for 'Net' (Network) text display
widget.TextBox(
font="Noto Sans", text="Net:", padding=2, fontsize=font_size
),
# Net widget to display network interface information and launch connection editor on click
widget.Net(
font="Noto Sans Bold",
interface=pc_spec.NET_INTERFACE,
format="{down:5.2f} {down_suffix} ↓↑ {up:5.2f} {up_suffix}",
mouse_callbacks={"Button1": lazy.spawn("nm-connection-editor")},
prefix="M",
fontsize=font_size,
padding=2,
scroll_fixed_width=True,
),
sc_sep,
]
if pc_spec.show_net
else []
)
+ [
# Custom TextBox widget for 'Vol' (Volume) text display
widget.TextBox(
font="Noto Sans",
text="Vol:",
padding=2,
fontsize=font_size,
mouse_callbacks={"Button1": lazy.spawn("pavucontrol")},
),
# Volume widget to display volume level and control with mouse scroll and click
widget.Volume(font="Noto Sans Bold", padding=2, fontsize=font_size),
widget.Volume(emoji=True, padding=2, fontsize=font_size),
]
+ (
[
sc_sep,
# Commented out Battery widget (uncomment to use in a laptop)
widget.TextBox( # Widget to display text
font="Noto Sans", text="Batt:", padding=1, fontsize=font_size
),
widget.Battery( # Battery widget to display battery status
format="{percent:2.0%}",
font="Noto Sans Bold",
update_interval=5,
fontsize=font_size,
padding=2,
),
]
if pc_spec.show_battery
else []
)
+ [
# Sep widget to add a separator between widgets
sc_sep,
# Do not disturb
widget.DoNotDisturb(
fontsize=font_size,
fmt="<b>{}</b>",
disabled_icon="notif ON",
enabled_icon="notif OFF",
padding=2,
),
sc_sep,
widget.QuickExit(
fontsize=font_size,
fmt="<b>{}</b>",
default_text="[X]",
countdown_format="[{}]",
padding=2,
),
sc_sep,
],
24,
background="#333333", # Set the background color of the bar
opacity=1, # Set the opacity of the bar (optional)
),
# Set the wallpaper path
wallpaper=f"{home}/.config/qtile/wallpapers/4k-3840-x-2160-wallpapers-themefoxx({img_number}).jpg",
wallpaper_mode="fill", # Set the wallpaper mode
)
img_numbers = [
10,
1000,
1011,
1016,
1018,
1024,
1027,
1032,
1054,
1069,
1071,
1072,
1078,
]
screens = [
def_screen(random.choice(img_numbers)),
def_screen(random.choice(img_numbers)),
]
# Drag floating layouts.
mouse = [
Drag(
[mod],
"Button1",
lazy.window.set_position_floating(),
start=lazy.window.get_position(),
),
Drag(
[mod], "Button3", lazy.window.set_size_floating(), start=lazy.window.get_size()
),
Click([mod], "Button2", lazy.window.bring_to_front()),
]
# Key bindings for dynamic groups are not used in this configuration
dgroups_key_binder = None
# Application rules for dynamic groups (currently empty)
dgroups_app_rules = [] # type: list
# When enabled, the focus will follow the mouse pointer
follow_mouse_focus = False
# Determines if windows should be brought to the front on click
bring_front_click = True
floats_kept_above = True
# When set to True, the cursor will warp to the center of the focused window.
cursor_warp = False
floating_layout = layout.Floating(
float_rules=[
# Run the utility of `xprop` to see the wm class and name of an X client.
*layout.Floating.default_float_rules,
Match(wm_class="confirmreset"), # gitk
Match(wm_class="makebranch"), # gitk
Match(wm_class="maketag"), # gitk
Match(wm_class="ssh-askpass"), # ssh-askpass
Match(title="branchdialog"), # gitk
Match(title="pinentry"), # GPG key password entry
Match(wm_class="veracrypt"),
Match(wm_class="nautilus"),
]
)
# Automatically set windows to fullscreen when they are created
auto_fullscreen = True
# Choose how to focus on windows when they are activated
focus_on_window_activation = "smart"
# When enabled, the screens will be reconfigured automatically
reconfigure_screens = True
# If things like steam games want to auto-minimize themselves when losing
# focus, should we respect this or not?
auto_minimize = True
# When using the Wayland backend, this can be used to configure input devices.
wl_input_rules = None
# XXX: Gasp! We're lying here. In fact, nobody really uses or cares about this
# string besides java UI toolkits; you can see several discussions on the
# mailing lists, GitHub issues, and other WM documentation that suggest setting
# this string if your java app doesn't work correctly. We may as well just lie
# and say that we're a working one by default.
#
# We choose LG3D to maximize irony: it is a 3D non-reparenting WM written in
# java that happens to be on java's whitelist.
wmname = "LG3D"
# Alter and move this to pc_spec.py
# how to find it: run in terminal: ifconfig, find the value
# or use nm-connection-editor to find it
NET_INTERFACE = "enp5s0"
show_battery = False
show_cpu = True
show_net = True
font_size = 12
add_video_screens = True
# Enabled client-side shadows on windows.shadow = true;
shadow-radius = 7; # The blur radius for shadows, in pixels.
shadow-offset-x = -7; # The left offset for shadows, in pixels.
shadow-offset-y = -7; # The top offset for shadows, in pixels.
# Specify a list of conditions of windows that should have no shadow.
shadow-exclude = [
"name = 'Notification'",
"class_g ?= 'Notify-osd'",
"name = 'Plank'",
"name = 'Docky'",
"name = 'Kupfer'",
"name = 'xfce4-notifyd'",
"name *= 'VLC'",
"name *= 'compton'",
"name *= 'Chromium'",
"name *= 'Chrome'",
"class_g = 'Firefox' && argb",
"class_g = 'Conky'",
"class_g = 'Kupfer'",
"class_g = 'Synapse'",
"class_g ?= 'Notify-osd'",
"class_g ?= 'Cairo-dock'",
"class_g = 'Cairo-clock'",
"class_g ?= 'Xfce4-notifyd'",
"class_g ?= 'Xfce4-power-manager'",
"_GTK_FRAME_EXTENTS@:c"
];
# Fade windows in/out when opening/closing and when opacity changes.
fading = false; # Set to true to enable window fading.
fade-in-step = 0.03; # Opacity change between steps while fading in.
fade-out-step = 0.03; # Opacity change between steps while fading out.
# Opacity settings.
inactive-opacity = 1; # Opacity of inactive windows.
frame-opacity = 1; # Opacity of inactive windows.
inactive-opacity-override = false; # Let inactive opacity set by -i override '_NET_WM_OPACITY'
# Specify a list of focus exclude.
focus-exclude = [ "class_g = 'Cairo-clock'" ];
# Specify a list of opacity rules.
opacity-rule = [
"90:class_g = 'Alacritty'"
]
# Specify the blur convolution kernel.
blur-kern = "3x3box";
# Parameters for background blurring. Note: `blur-method` and `blur-size` are not set.
blur-background-exclude = [
"window_type = 'dock'",
"window_type = 'desktop'",
"_GTK_FRAME_EXTENTS@:c"
];
# Use the xrender backend.
backend = "xrender";
vsync = true; #prevent screen tearing
mark-wmwin-focused = true;
mark-ovredir-focused = true;
detect-rounded-corners = true;
detect-client-opacity = true;
detect-transient = true;
detect-client-leader = true;
use-damage = true;
log-level = "warn";
# Specify window type settings.
wintypes:
{
tooltip = { fade = true; shadow = true; opacity = 0.9; focus = true; full-shadow = false; };
dock = { shadow = false; };
dnd = { shadow = false; };
popup_menu = { opacity = 0.9; };
dropdown_menu = { opacity = 0.9; };
};
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="half-life"
# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in $ZSH/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment one of the following lines to change the auto-update behavior
# zstyle ':omz:update' mode disabled # disable automatic updates
# zstyle ':omz:update' mode auto # update automatically without asking
# zstyle ':omz:update' mode reminder # just remind me to update when it's time
# Uncomment the following line to change how often to auto-update (in days).
# zstyle ':omz:update' frequency 13
# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS="true"
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# You can also set it to another string to have that shown instead of the default red dots.
# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f"
# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765)
# COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git ssh-agent pip ssh pipenv poetry python rsync snap
terraform tmux vscode ansible command-not-found docker docker-compose)
source $ZSH/oh-my-zsh.sh
# User configuration
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
eval "$(zoxide init zsh)"
export QT_QPA_PLATFORMTHEME=qt5ct
if [[ ":$PATH:" != *":$HOME/.local/bin:"* && ":$PATH:" != *":$HOME/bin:"* ]]; then
PATH="$HOME/.local/bin:$HOME/bin:$PATH"
fi
export PATH
export PATH="/usr/local/cuda/bin/:$PATH"
export LD_LIBRARY_PATH="/usr/local/cuda/lib64:$LD_LIBRARY_PATH"
export AWS_PROFILE="WaineAeroSim"
setopt +o nomatch # Allow wildcard * selection
# Start ssh agent
if [ -z "$SSH_AUTH_SOCK" ]; then
# Check for a currently running instance of the agent
RUNNING_AGENT=$(ps -ax | grep 'ssh-agent -s' | grep -v grep | wc -l | tr -d '[:space:]')
if [ "$RUNNING_AGENT" = "0" ]; then
# Launch a new instance of the agent
ssh-agent -s &> .ssh/ssh-agent
fi
eval $(cat .ssh/ssh-agent)
fi
# Avoid poetry errors
export PYTHON_KEYRING_BACKEND=keyring.backends.fail.Keyring
[ -f ~/.config/rclone/mount-drive.sh ] && bash ~/.config/rclone/mount-drive.sh > /dev/null 2>&1

bluetoothctl

#!/bin/bash

# Start bluetoothctl
bluetoothctl << EOF
# Turn on Bluetooth if not already on
power on
# Start scanning for devices
scan on
# Wait for the device to be discovered
sleep 10
# Stop scanning
scan off
# To show devices names
# devices
# Pair with the device
pair <device_mac_address>
# Connect to the device
connect <device_mac_address>
# Exit bluetoothctl
exit
EOF

Connect to Edifier

#!/bin/bash

# Start bluetoothctl
bluetoothctl << EOF
power on
# Scan if not found
# Show devices
devices
# Pair with the device (if already paired no need)
pair 64:68:76:43:2F:FE
# Connect with it
connect 64:68:76:43:2F:FE
# Exit
exit
EOF
sudo dnf install -y wget make gcc-c++ freeglut-devel libXi-devel libXmu-devel mesa-libGLU-devel
# I apparently can install only akmod-nvidia
# sudo dnf install -y xorg-x11-drv-nvidia akmod-nvidia xorg-x11-drv-nvidia-cuda
sudo dnf install -y akmod-nvidia
sudo dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/fedora39/x86_64/cuda-fedora39.repo
sudo dnf clean all
# I think this can be disabled
# sudo dnf module disable nvidia-driver
# I got this error https://www.reddit.com/r/Fedora/comments/1dixseb/recent_nvidia_rpm_driver_update_errors/
# Did the same, removed and installed all again, and it worked
# https://discussion.fedoraproject.org/t/solution-modular-filtering-issue-for-nvidia-drivers-cuda-sources-conflict/78440
# https://copr.fedorainfracloud.org/coprs/t0xic0der/nvidia-auto-installer-for-fedora/
sudo dnf -y install cuda
sudo dnf install libxcrypt-compat
# I have the required .so files
sudo cp -r lib-davinci/* /opt/resolve/libs/
# From https://reddit.com/r/voidlinux/comments/12g71x0/davinci_resolve_18_symbol_lookup_error_libgdk/
cd /opt/resolve/libs
mkdir _disabled
mv libglib-2.0.so* _disabled/
cd
# THE DOWNLOAD LINK IS DOWN, ASK FOR ME THE FILE, I HAVE IT
# cd /tmp
# mkdir pixbuf
# cd pixbuf
# wget https://dl.fedoraproject.org/pub/fedora/linux/releases/38/Everything/x86_64/os/Packages/g/gdk-pixbuf2-2.42.10-2.fc38.x86_64.rpm
# rpm2cpio ./gdk-pixbuf-devel-2.42.10-2.1.x86_64.rpm | cpio -idmv
# cd usr/lib64
# sudo cp -r * /opt/resolve/libs/
pip3 install qtile psutil fpdf # psutil for CPU/RAM, etc
# Install zsh
sudo dnf install -y zsh
# Install oh-my-zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# install kitty
curl -L https://sw.kovidgoyal.net/kitty/installer.sh | sh /dev/stdin
# Create symbolic links to add kitty and kitten to PATH (assuming ~/.local/bin is in
# your system-wide PATH)
ln -sf ~/.local/kitty.app/bin/kitty ~/.local/kitty.app/bin/kitten ~/.local/bin/
# Place the kitty.desktop file somewhere it can be found by the OS
cp ~/.local/kitty.app/share/applications/kitty.desktop ~/.local/share/applications/
# If you want to open text files and images in kitty via your file manager also add the kitty-open.desktop file
cp ~/.local/kitty.app/share/applications/kitty-open.desktop ~/.local/share/applications/
# Update the paths to the kitty and its icon in the kitty desktop file(s)
sed -i "s|Icon=kitty|Icon=/home/$USER/.local/kitty.app/share/icons/hicolor/256x256/apps/kitty.png|g" ~/.local/share/applications/kitty*.desktop
sed -i "s|Exec=kitty|Exec=/home/$USER/.local/kitty.app/bin/kitty|g" ~/.local/share/applications/kitty*.desktop
# Brightness control and acpi
sudo dnf install -y brightnessctl acpid
sudo systemctl enable acpid
sudo systemctl start acpid
# For blue light filter geoclue required (GUI only works in X11)
sudo dnf install -y libX11-devel libXrandr libXrandr-devel
git clone https://github.com/jumper149/blugon.git ~/.blugon
cd ~/.blugon
# git checkout 1.12.0 # Currently main and further branches break in ubuntu, fedora no
make
sudo make install
cd -
# Configure blugon
# cp /usr/share/blugon/configs/default/gamma ~/.config/blugon/gamma
mkdir ~/.config/blugon
ln -s $(pwd)/../.configs/blugon/gamma ~/.config/blugon/gamma
blugon --printconfig > ~/.config/blugon/config
sudo dnf install -y rofi gnome-screenshot picom
sudo dnf groupinstall -y "Development Tools" "Development Libraries"
sudo dnf install -y pavucontrol xbacklight google-noto-emoji-fonts dejavu-sans-fonts
sudo dnf install -y alsa-tools # Audio
sudo dnf install -y thunar # file manager
sudo dnf install -y qt5ct # file manager
sudo dnf install -y zathura zathura-pdf-mupdf # PDF Viewer
sudo dnf install -y NetworkManager-tui # TUI for network manager, use nmtui
sudo dnf install -y playerctl # Control music play (stop, start, next, etc.)
# For keyboard state
git clone https://github.com/nonpop/xkblayout-state.git
cd xkblayout-state
make
sudo cp xkblayout-state /usr/local/bin/
cd -
# Install arc-theme for GTK
sudo dnf install -y arc-theme lxappearance
# Overwride Theme for thunar and GTK
#
echo "[Settings]
gtk-theme-name=Arc-Dark
gtk-icon-theme-name=Adwaita
gtk-font-name=Sans 10
gtk-cursor-theme-name=Adwaita
gtk-cursor-theme-size=0
gtk-toolbar-style=GTK_TOOLBAR_BOTH
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
gtk-button-images=0
gtk-menu-images=0
gtk-enable-event-sounds=1
gtk-enable-input-feedback-sounds=1
gtk-xft-antialias=1
gtk-xft-hinting=1
gtk-xft-hintstyle=hintmedium
" | sudo tee ~/.config/gtk-3.0/settings.ini > /dev/null
# Set the theme for GNOME applications as well
sudo gsettings set org.gnome.desktop.interface gtk-theme "Arc-Dark"
# Allacritty (https://github.com/alacritty/alacritty/blob/master/INSTALL.md)
sudo dnf install -y cmake freetype-devel fontconfig-devel libxcb-devel libxkbcommon-devel g++
# Rust needs to be installed as well
cargo install alacritty
# Add qtile entry
echo "[Desktop Entry]
Name=Qtile
Comment=Qtile Session
Exec=/home/waine/.local/bin/qtile start
Type=Application
Keywords=wm;tiling" | sudo tee /usr/share/xsessions/qtile.desktop > /dev/null
# Use arandr to configure screens
# Save results o .xprofile
# Enable rmp fusion free and non-free
sudo dnf install -y https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
sudo dnf install -y https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
# Install scrcpy for tablet streaming
sudo dnf copr -y enable zeno/scrcpy && sudo dnf install -y scrcpy
sudo dnf install -y v4l2loopback
sudo modprobe v4l2loopback
# Misc for audiovisual
sudo dnf install -y ffmpeg adb wget vlc easyeffects --allowerasing
sudo dnf install -y apr apr-util mesa-libGLU
# For virtual machine
sudo dnf install -y libvirt virt-install virt-manager qemu-kvm
sudo dnf group install -y --with-optional virtualization
sudo systemctl start libvirtd
sudo systemctl enable libvirtd
# latex and tex https://ohmyz.sh/#install
sudo dnf install -y latexmk texlive-scheme-medium texlive-minted \
texlive-collection-fontsrecommended \
texlive-collection-fontsextra \
texlive-collection-fontutils \
texlive-scheme-full # Install full, everything
# Utils
sudo dnf install -y zoxide zsh
# Do not disturb
sudo dnf install dunst
# Add eval "$(zoxide init zsh)" to zsh (same to bashrc)
# Oh My ZSH! ()
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# Install fzf
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install
# Install for PDF
sudo dnf install -y zathura zathura-pdf-mupdf
pip3 install fpdf
# add
# source /usr/share/fzf/shell/key-bindings.bash
# to .bashrc
sudo dnf install -y git vim openssh-server pandoc paraview
# Dev tools
sudo dnf install -y make automake gcc gcc-c++ kernel-devel
# Python
sudo dnf install -y python3 python3-devel python3-pip
# Node
sudo dnf install -y nodejs
sudo dnf install -y texstudio steam
pip install poetry
#!/usr/bin/env bash
# from https://forum.obsidian.md/t/gnome-desktop-installer/499
set -euo pipefail
dl_url=${1:-}
if [[ -z "$dl_url" ]]; then
echo "missing download link"
echo "usage: install-obsidian.sh <download url>"
exit 1
fi
curl --location --output Obsidian.AppImage "$dl_url"
sudo mkdir --parents /opt/obsidian/
sudo mv Obsidian.AppImage /opt/obsidian
sudo chmod u+x /opt/obsidian/Obsidian.AppImage
sudo cp obsidian-icon.svg /opt/obsidian/obsidian.svg
sudo ln -s /opt/obsidian/obsidian.svg /usr/share/pixmaps
echo "[Desktop Entry]
Type=Application
Name=Obsidian
Exec=/opt/obsidian/Obsidian.AppImage
Icon=/opt/obsidian/obsidian.svg
Terminal=false" > ~/.local/share/applications/obsidian.desktop
update-desktop-database ~/.local/share/applications
echo '#!/usr/bin/bash
/opt/obsidian/Obsidian.AppImage' | sudo tee /usr/local/bin/obsidian > /dev/null
sudo chmod +x /usr/local/bin/obsidian
echo "install ok"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment