Switch to Hyprland

This commit is contained in:
KoenDR06 2025-03-05 19:16:48 +01:00
parent acdd4d263c
commit 38355d7ba5
29 changed files with 33 additions and 1468 deletions

View file

@ -2,6 +2,6 @@
imports = [
./gnome
./plasma
./qtile
./hyprland
];
}

View file

@ -0,0 +1,30 @@
{
inputs,
outputs,
lib,
config,
pkgs,
...
}: let
inherit (lib) mkEnableOption mkIf mkOption types;
cfg = config.horseman.wm.hyprland;
in {
options = {
horseman.wm.hyprland = {
enable = mkEnableOption "HyprLand";
};
};
config = mkIf cfg.enable {
programs.hyprland = {
enable = true;
xwayland.enable = true;
};
security.polkit.enable = true;
environment.systemPackages = with pkgs; [
xdg-desktop-portal-hyprland
nerdfonts
];
};
}

View file

@ -1,20 +0,0 @@
MIT License
Copyright (c) 2020 Daniel Diaz
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

View file

@ -1,91 +0,0 @@
# Qtile configuration file
## Screenshots 🖥️
![Qtile Screenshots](../assets/Remake-1.png)
![Qtile Screenshots](../assets/Remake-2.png)
![Qtile Screenshots](../assets/REMAKE-3.png)
## What is Qtile?
[Qtile](http://www.qtile.org/) is a window manager written and configured in Python🐍. It is hackable and lightweight, you can install it among other desktop environments and [standalone WM's](https://wiki.archlinux.org/index.php/window_manager).
## Installation 🐧
Install Qtile and other dependencies.
### For Arch Linux
All software, one command:
```bash
yay -S qtile picom rofi nitrogen xorg-server-xephyr
lxappearance-gtk3 megasync python-psutil brave-browser alacritty
bat playerctl pulseaudio-ctl dunst alacritty fish starship neovim
pavucontrol flameshot noto-fonts-emoji noto-fonts-emoji brightnessctl blueman xfce4-power-manager network-manager-applet xfce4-clipman-plugin
```
Also install Rofi Power menu:
```
git clone git@github.com:jluttine/rofi-power-menu.git
cp rofi-power-menu ~/.local/bin/
```
The [xephyr](https://wiki.archlinux.org/index.php/Xephyr) package is for testing purposes.
[Nitrogen](https://wiki.archlinux.org/index.php/nitrogen) help us to set a cool wallpaper since Qtile doesn't have a wallpaper manager by default.
### For Debian, Ubuntu
For Debian, Ubuntu and derivates [here](http://docs.qtile.org/en/latest/manual/install/ubuntu.html) is the qtile installation guide.
#### Dependencies
```
sudo apt install picom rofi xserver-xephyr nitrogen
```
## Cloning the config files 📁
```
git clone git@github.com:DaniDiazTech/Qtile-Config.git ~/.config/qtile
```
## Testing 🧪
If you want to test the config files without crashing your current qtile instance, type the following commands:
```
Xephyr -br -ac -noreset -screen 1280x720 :1 &
DISPLAY=:1 qtile "/PATH/TO/TEST-CONFIG"
```
Once you've done all these steps you should have a cool Qtile instance, but most keybindings won't work, because probably you don´t have the software I use, you could install [my software](https://github.com/DaniDiazTech/Qtile-Config/blob/main/software.txt) or re-map the keybindings in [keybindings.py](https://github.com/Daniel1404/Qtile-Config/blob/main/keybindings.py) file.
## Startup 🏁
One of the most important functions in the config is the startup function located at the bottom of _config.py_.
``` python
@hook.subscribe.startup_once
def start_once():
home = os.path.expanduser('~')
subprocess.call([home + '/.config/qtile/autostart.sh'])
```
You can manage the autostart applications editing the _autostart.sh_ file.
``` bash
#! /bin/bash
picom --experimental-backend &
nitrogen --restore &
```
You can setup your Qtile instance quickly using the `setup.py` file:
```python
python setup.py
```
Remember to set a wallpaper with nitrogen so every time you boot into Qtile, your wallpaper will be restored.

View file

@ -1,104 +0,0 @@
###############################################
### QTILE CONFIGURATION FILE OF DANIEL DIAZ ###
#
# ____ ____
# | _ \ | _ \ Copyright (c) 2020 Daniel Diaz
# | | | || | | |
# | |_| || |_| | http://www.github.com/DaniDiazTech/
# |____/ |____/
#
####### IMPORTS #########
import os
import subprocess
# from typing import List # noqa: F401
from libqtile import hook, layout
from libqtile.config import Group, Match
# Local Files
from keys.keybindings import Mouse,Keybindings
from widgets import MyWidgets
from layouts import Layouts
from groups import CreateGroups
from icons import group_icons
###### MAIN ######
if __name__ in ["config", "__main__"]:
# Initializes objects
# Initializes keybindings
obj_keys = Keybindings()
# Mouse
obj_mouse = Mouse()
obj_widgets = MyWidgets()
obj_layouts = Layouts()
obj_groups = CreateGroups()
# Initializes qtile variables
keys = obj_keys.init_keys()
mouse = obj_mouse.init_mouse()
layouts = obj_layouts.init_layouts()
groups = obj_groups.init_groups()
# Append group keys for groups
keys += obj_keys.init_keys_groups(group_icons)
### DISPLAYS WIDGETS IN THE SCREEN ####
screens = obj_widgets.init_screen()
main_widgets_list = obj_widgets.init_widgets_list()
widgets_screen1 = obj_widgets.init_widgets_screen()
dgroups_key_binder = None
dgroups_app_rules = [] # type: list
follow_mouse_focus = True
bring_front_click = False
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='dialog'), # Dialogs stuff
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
])
auto_fullscreen = True
focus_on_window_activation = "smart"
reconfigure_screens = True
# If things like steam games want to auto-minimize themselves when losing
# focus, should we respect this or not?
respect_minimize_requests = True
# XXX: Gasp! We're lying here. In fact, nobody really uses or cares about this
wmname = "LG3D"
@hook.subscribe.startup_once
def start_once():
home = os.path.expanduser('~')
subprocess.call([home + '/.local/bin/autostart'])
@hook.subscribe.client_new
def dialogs(window):
if(window.window.get_wm_type() == 'dialog' or window.window.get_wm_transient_for()):
window.floating = True

View file

@ -1,117 +0,0 @@
"""
MODIFY THIS FILE TO CREATE CUSTOM KEYBINDINGS
Keybindings are configured with tuples, inside Predifined lists Variables
Modifier -> list() -> Ex: [MOD, CONTROL]
Key -> str() -> Ex: 'j'
Command -> str() -> Ex: vscode
(Modifier, Key, Command)
"""
from libqtile.confreader import ConfigError
# Import default mod keys
from keys.default import *
from functions import PWA
from os.path import expanduser
HOME = expanduser("~")
# Define constants here
TERMINAL = "alacritty"
# Basic window manager movements
# Qtile shutdown/restart keys
SHUTDOWN_MODIFIER = [MOD, CONTROL]
RESTART = "r"
SHUTDOWN = "q"
# Group movement keys:
GROUPS_KEY = CONTROL
SWAP_GROUP_KEY = SHIFT
NEXT_GROUP = "period"
PREV_GROUP = "comma"
# ------------ Hardware Configs ------------
HARDWARE_KEYS = [
# (Modifier, Key, Command)
# Volume
([], "XF86AudioLowerVolume", "pactl set-sink-volume @DEFAULT_SINK@ -5%"),
([], "XF86AudioRaiseVolume", "pactl set-sink-volume @DEFAULT_SINK@ +5%"),
([], "XF86AudioMute", "pactl set-sink-mute @DEFAULT_SINK@ toggle"),
# Brightness
([], "XF86MonBrightnessUp", "brightnessctl set +5%"),
([], "XF86MonBrightnessDown", "brightnessctl set 5%-"),
]
APPS = [
([MOD], "Return", TERMINAL),
# (Modifier, Key, Command)
([MOD], "e", "thunar"),
([MOD, ALT], "d", "emacs"),
([MOD, ALT], "o", "env LIBGL_ALWAYS_SOFTWARE=1 obs"),
([MOD, ALT], "v", "gvim"),
([MOD, ALT], "b", "brave"),
([MOD, ALT], "c", "code"),
([MOD, ALT], "p", "pycharm"),
([MOD, ALT], "a", "pavucontrol"),
([MOD, ALT], "e", "vim -g .config/qtile/config.py"),
([MOD, ALT], "z", "zoom"),
# Media hotkeys
([MOD], "Up", "pulseaudio-ctl up 5"),
([MOD], "Down", "pulseaudio-ctl down 5"),
# Makes reference to play-pause script
# You can find it in my scripts repository
([ALTGR], "space", "play-pause"),
# Run "rofi-theme-selector" in terminal to select a theme
([MOD], "space", 'rofi -modi "drun,power-menu:rofi-power-menu,run,window,ssh" -show drun -show-icons'),
# Screenshots
([], "Print", "xfce4-screenshooter"),
# Full screen screenshot
([ALT], "Print", "xfce4-screenshooter -f -c"),
# Terminal apps
([MOD, ALT], "n", TERMINAL + " -e nvim"),
]
##########################
# Your custom keys here #
##########################
CUSTOM_SPAWN_KEYS = [
# PWA keys
([MOD, ALT], "s", PWA.spotify()),
([MOD, ALT], "m", PWA.music()),
([MOD, ALT], "t", PWA.calendar()),
([MOD, ALT], "y", PWA.youtube()),
([MOD, ALT], "l", PWA.notion()),
([MOD, ALT], "h", PWA.habitica()),
]
SPAWN_KEYS = HARDWARE_KEYS + APPS + CUSTOM_SPAWN_KEYS
SPAWN_CMD_KEYS = [
# Takes full screenshot and creates a file on the screenshot folder
([SHIFT], "Print", f"xfce4-screenshooter -f -s {HOME}/Pictures/Screenshots/"),
]

View file

@ -1,85 +0,0 @@
from libqtile.lazy import lazy
# from libqtile.command_client import InteractiveCommandClient
class Functions:
##### MOVE WINDOW IN GROUPS #####
@staticmethod
def window_to_prev_group():
@lazy.function
def __inner(qtile):
i = qtile.groups.index(qtile.current_group)
if qtile.current_window and i != 0:
group = qtile.groups[i - 1].name
qtile.current_window.togroup(group, switch_group=True)
return __inner
@staticmethod
def window_to_next_group():
@lazy.function
def __inner(qtile):
i = qtile.groups.index(qtile.current_group)
if qtile.current_window and i != len(qtile.groups):
group = qtile.groups[i + 1].name
qtile.current_window.togroup(group, switch_group=True)
return __inner
##### KILL ALL WINDOWS #####
@staticmethod
def kill_all_windows():
@lazy.function
def __inner(qtile):
for window in qtile.current_group.windows:
window.kill()
return __inner
@staticmethod
def kill_all_windows_minus_current():
@lazy.function
def __inner(qtile):
for window in qtile.current_group.windows:
if window != qtile.current_window:
window.kill()
return __inner
class PWA:
def __init__(self):
pass
@staticmethod
def notion():
return "brave --profile-directory=Default --app=https://notion.so"
@staticmethod
def music():
return "brave --profile-directory=Default --app=https://music.youtube.com/"
@staticmethod
def spotify():
return "brave --profile-directory=Default --app=https://open.spotify.com/"
@staticmethod
def youtube():
return "brave --user-data-dir=Default --app=https://www.youtube.com"
@staticmethod
def calendar():
return "brave --profile-directory=Default --app=https://calendar.google.com/calendar/"
@staticmethod
def habitica():
return "brave --profile-directory=Default --app=https://habitica.com/"
if __name__ == "__main__":
print("This is an utilities module")

View file

@ -1,17 +0,0 @@
from libqtile.config import Group
from icons import group_icons
class CreateGroups:
group_names = group_icons
def init_groups(self):
"""
Return the groups of Qtile
"""
#### First and last
groups = [Group(name, layout="max") if name == self.group_names[0]
else Group(name, layout="floating")
if name == self.group_names[-1] else Group(name, layout="monadtall")
for name in self.group_names]
return groups

View file

@ -1,15 +0,0 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# You can define a letter and its icon here
group_icons = ["B  ",
"D  ",
"T  ",
"V  ",
"M  ",
"C  ",
"E  ",
"N  ",
]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 218 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 746 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 288 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 365 B

View file

@ -1,4 +0,0 @@
def create_keybinding():
"""
Returns a key object based on a dictionary
"""

View file

@ -1,60 +0,0 @@
"""Qtile default keybindings"""
# Keys
MOD = "mod4"
ALT = "mod1"
ALTGR = "mod5"
SHIFT = "shift"
CONTROL = "control"
# Basic wm bindings
# All of these variables include the MOVEMENT_KEYS at the start
# The key which the WM will use to move the layouts
MOVEMENT_KEY = MOD
KILL_KEY = MOD
SWAP_KEY = SHIFT
FLOATING_KEY = SHIFT
############ BINDINGS FOR MONADTALL ##############
# Move between windows
LEFT = "h"
RIGHT = "l"
DOWN = "j"
UP = "k"
# Swap windows
SWAP_LEFT = "h"
SWAP_RIGHT = "l"
SWAP_DOWN = "j"
SWAP_UP = "k"
SWAP_FLIP = "space" # Flip the layout
########### LAYOUTS ###############
# Change windows lenght
GROW = "i"
SHRINK = "m"
NORMALIZE = "n"
MAXIMIZE = "o"
# Floating layout
TOOGLE_FLOATING = "f"
TOOGLE_FULL = "g"
# Groups key
# Move screen to next and previous group
NEXT = "k"
PREVIOUS = "j"
# Kill Functions
KILL_CURRENT = "w"
KILL_ALL = "x"
KILL_ALL_MINUS_CURRENT = "c"
# Rotates layouts
TOOGLE_LAYOUT = "Tab"

View file

@ -1,165 +0,0 @@
from libqtile.config import Click, Drag, Key
from libqtile.lazy import lazy
# Import the function that move the window to the next and prev group
from functions import Functions, PWA
from config_keybindings import *
class Keybindings:
keys = []
spawn_keys = SPAWN_KEYS
cmd_keys = SPAWN_CMD_KEYS
def create_layout_keys(self):
############ BINDINGS FOR MONADTALL ##############
modifier = [MOVEMENT_KEY]
layout_left = Key(modifier, LEFT, lazy.layout.left())
layout_right = Key(modifier, RIGHT, lazy.layout.right())
layout_down = Key(modifier, DOWN, lazy.layout.down())
layout_up = Key(modifier, UP, lazy.layout.up())
toogle_layout = Key(modifier, TOOGLE_LAYOUT, lazy.next_layout())
self.keys += [layout_left, layout_right, layout_down, layout_up, toogle_layout]
def create_swap_keys(self):
modifier = [MOVEMENT_KEY, SWAP_KEY]
left = Key(modifier, SWAP_LEFT, lazy.layout.swap_left())
right = Key(modifier, SWAP_RIGHT, lazy.layout.swap_right())
down = Key(modifier, SWAP_DOWN, lazy.layout.shuffle_down())
up = Key(modifier, SWAP_UP, lazy.layout.shuffle_up())
flip = Key(modifier, SWAP_FLIP, lazy.layout.flip())
self.keys += [left, right, down, up, flip]
def create_windows_keys(self):
modifier = [MOVEMENT_KEY]
grow = Key(modifier, GROW, lazy.layout.grow())
shrink = Key(modifier, SHRINK, lazy.layout.shrink())
normalize = Key(modifier, NORMALIZE, lazy.layout.normalize())
maximize = Key(modifier, MAXIMIZE, lazy.layout.maximize())
self.keys += [grow, shrink, normalize, maximize]
def create_shutdown_keys(self):
shutdown = Key(SHUTDOWN_MODIFIER, SHUTDOWN, lazy.shutdown())
restart = Key(SHUTDOWN_MODIFIER, RESTART, lazy.restart())
self.keys += [shutdown, restart]
def create_kill_keys(self):
modifier = [MOVEMENT_KEY, ALTGR]
all_minus_current = Key(modifier, KILL_ALL_MINUS_CURRENT,
Functions.kill_all_windows_minus_current())
all_ = Key(modifier, KILL_ALL,
Functions.kill_all_windows())
current = Key([KILL_KEY], KILL_CURRENT,
lazy.window.kill())
self.keys += [all_minus_current, all_, current]
def create_floating_keys(self):
modifier = [MOVEMENT_KEY, FLOATING_KEY]
floating = Key(modifier, TOOGLE_FLOATING, lazy.window.toggle_floating())
full = Key(modifier, TOOGLE_FULL, lazy.window.toggle_fullscreen())
self.keys += [floating, full]
def create_groups_keys(self):
modifier = [GROUPS_KEY]
swap_modifier = [GROUPS_KEY, SWAP_GROUP_KEY]
screen_modifier = [MOVEMENT_KEY]
move_next = Key(modifier, NEXT_GROUP, lazy.screen.next_group())
move_prev = Key(modifier, PREV_GROUP, lazy.screen.prev_group())
swap_next = Key(swap_modifier, NEXT_GROUP, Functions.window_to_next_group())
swap_prev = Key(swap_modifier, PREV_GROUP, Functions.window_to_prev_group())
move_next_screen = Key(screen_modifier, NEXT_GROUP, lazy.next_screen())
move_prev_screen = Key(screen_modifier, PREV_GROUP, lazy.next_screen())
self.keys += [move_next, move_prev, swap_next, swap_prev, move_next_screen, move_prev_screen]
def create_spawn_keys(self):
for spawn_key in self.spawn_keys:
modifier, key, command = spawn_key
keybinding = Key(modifier, key, lazy.spawn(command))
self.keys.append(keybinding)
def create_cmd_keys(self):
for cmd_key in self.cmd_keys:
modifier, key, command = cmd_key
keybinding = Key(modifier, key, lazy.spawncmd(command))
self.keys.append(keybinding)
def init_keys_groups(self, group_names):
"""
Create bindings to move between groups
"""
group_keys = []
for icon in group_names:
index = (icon[0]).lower()
group_keys += [Key([MOVEMENT_KEY, GROUPS_KEY], index, lazy.group[icon].toscreen()), Key(
[MOVEMENT_KEY, SWAP_GROUP_KEY], index, lazy.window.togroup(icon, switch_group=True))]
return group_keys
def init_keys(self):
self.create_layout_keys()
self.create_swap_keys()
self.create_windows_keys()
self.create_shutdown_keys()
self.create_kill_keys()
self.create_floating_keys()
self.create_groups_keys()
self.create_cmd_keys()
self.create_spawn_keys()
return self.keys
class Mouse:
def __init__(self, mod_key=MOD):
self.mod = mod_key
def init_mouse(self):
mouse = [
Drag([self.mod], "Button1", lazy.window.set_position_floating(),
start=lazy.window.get_position()),
Drag([self.mod], "Button3", lazy.window.set_size_floating(),
start=lazy.window.get_size()),
Click([self.mod], "Button2", lazy.window.bring_to_front())
]
return mouse

View file

@ -1,15 +0,0 @@
"""
Script that automates the process of writing a keybindings.md
By directly getting the keybindings from keybindings.py
"""
# Local import
from keybindings import Keybindings
def get_keybindings():
current_keybindings = Keybindings()
list_of_keys = list(current_keybindings.init_keys())
return list_of_keys
print(*get_keybindings(), sep="\n")

View file

@ -1,51 +0,0 @@
from libqtile import layout
class Layouts:
def __init__(self):
self.default = {
"border_width": 2,
"margin": 8,
"border_focus": "#668bd7",
"border_normal": "1D2330"}
def init_layouts(self):
"""
Returns the layouts variable
"""
layouts = [
layout.Max(**self.default),
layout.MonadTall(**self.default),
layout.floating.Floating(**self.default),
layout.TreeTab(
font="Ubuntu",
fontsize=10,
sections=["FIRST", "SECOND", "THIRD", "FOURTH"],
section_fontsize=10,
border_width=2,
bg_color="1c1f24",
active_bg="c678dd",
active_fg="000000",
inactive_bg="a9a1e1",
inactive_fg="1c1f24",
padding_left=0,
padding_x=0,
padding_y=5,
section_top=10,
section_bottom=20,
level_shift=8,
vspace=3,
panel_width=200
),
# layout.Stack(num_stacks=2),
# Try more layouts by unleashing below layouts.
# layout.Bsp(),
# layout.Columns(),
# layout.Matrix(),
# layout.MonadWide(**self.default),
# layout.RatioTile(),
# layout.Tile(),
# layout.VerticalTile(),
# layout.Zoomy(),
]
return layouts

View file

@ -1,26 +0,0 @@
#!/usr/bin/env bash
# ---
# Use "run program" to run it only if it is not already running
# Use "program &" to run it regardless
# ---
# NOTE: This script runs with every restart of AwesomeWM
# TODO: run_once
function run {
if ! pgrep $1 > /dev/null ;
then
$@&
fi
}
run picom -CGb &
run nitrogen --restore &
run /usr/lib/polkit-kde-authentication-agent-1 &
run megasync
run xfce4-clipman
run xfce4-power-manager
run gammy
run dunst
run nm-applet
run blueman-applet

View file

@ -1,4 +0,0 @@
#!/usr/bin/env bash
playerctl play-pause

View file

@ -1,225 +0,0 @@
# /usr/bin/python
# Os level operations
import os
from getpass import getuser
# Determinates if the program is installed
from shutil import which
# Get the OS I'm in
import platform
INSTALL_PATH = ".local/bin"
def print_program_welcome():
row = "=" * 55
sep = "||"
welcome = "SETUP SCRIPT OF DANIEL'S QTILE CONFIG".center(len(row) - len(sep) * 2)
welcome = sep + welcome + sep
print(row)
print("")
print(welcome)
print("")
print(row + "\n")
print(f"Hi there {getuser()}, you are about to setup Qtile".center(len(row)))
print("\n" + row)
def print_current_dir():
print(f"Currently you are in {os.getcwd()} directory")
def get_correct_os():
"""
Returns the Os name:
get_os -> bool
Linux: linux
Mac: darwin
Windows: windows
"""
os = platform.system().lower()
return os == "linux"
def get_home_path():
"""
Get Linux home path
get_home_path -> str
"""
return os.path.expanduser("~")
def get_local_bin(home):
"""
Returns the local bin path of the User
"""
return f"{home}/.local/bin"
def check_local_folder_exists():
"""
Check if .local/bin exists
"""
home = get_home_path()
local = get_local_bin(home)
return os.path.exists(local)
def create_local_install_folder(local_bin):
"""
Creates local bin folder
"""
print("")
print(f"Creating folder ar {local_bin}")
print("")
try:
os.mkdir(local_bin)
except OSError:
raise OSError(f"Creation of the directory {local_bin} failed")
else:
print(f"Successfully created the directory {local_bin}")
def get_response(message="yes/no"):
"""
returns -> bool
"""
while True:
response = input(message).lower()
if response == "yes":
return True
elif response == "no":
return False
else:
print("\nSorry your response must be yes or no\n")
continue
LOCAL_BIN = get_local_bin(get_home_path())
def link_scripts(path):
path = os.path.abspath(path)
if not os.path.exists(path):
raise OSError("Sorry that path doesn't exist")
os.chdir(path)
i = 0
for file_ in os.listdir(path):
file_path = os.path.abspath(file_)
file_name = file_.split(".")[0]
link_path = LOCAL_BIN + f"/{file_name}"
if os.path.exists(link_path):
print("You have already in path", file_name)
continue
os.link(file_path, link_path)
i += 1
return f"Linked {i} files to .local/bin"
def get_dependencies(software_path="software.txt"):
"""software_path -> path of software.txt
returns list of dependencies
"""
if not os.path.exists(software_path):
print(f"The file {software_path} wasn't found. Please clone again or provide one")
if get_response("Continue without dependencies warnings? [yes/no]"):
print("Dependencies won't be shown")
return None
else:
print("Clone again or provide a file.")
exit()
software = []
with open(software_path, "r") as file_:
for line in file_:
software.append(line.strip())
return software
def check_dependencies(dependencies=None):
"""dependencies -> list
returns -> str programs that aren't installed
"""
if dependencies is None:
return ""
not_installed = []
for program in dependencies:
if which(program) is not None:
continue
not_installed.append(program)
first_row = "The following software is not installed, some scripts may not work\n"
if not_installed:
return first_row + "\n".join(not_installed)
else:
return ""
def main():
print_program_welcome()
if not get_correct_os():
raise OSError("Sorry Qtile is only supported in Linux")
if not check_local_folder_exists():
print("\n.local/bin folder doesn't exists\n")
response = get_response(message="Do you want to create that directory [yes, no] >> ")
if not response:
print("Setup can't continue if .local/bin doesn't exists")
print("Rerun the script or set up the scripts manually")
exit()
print("Creating .local/bin/folder")
create_local_install_folder(LOCAL_BIN)
dependencies = get_dependencies()
scripts_path = "./scripts"
print(check_dependencies(dependencies=dependencies))
print(link_scripts(path=scripts_path))
if __name__ == "__main__":
main()

View file

@ -1,11 +0,0 @@
picom
nitrogen
megasync
xfce4-clipman-plugin
playerctl
pulseaudio-ctl
bat
python-psutil
alacritty
brave-browser
lxappearance-gtk3

View file

@ -1,456 +0,0 @@
import os
from libqtile import bar, widget
from libqtile.lazy import lazy
from libqtile.config import Screen
from functions import PWA
# widget_defaults = dict(
# font="Ubuntu Mono",
# fontsize = 12,
# padding = 2,
# background=colors[2]
# )
# extension_defaults = widget_defaults.copy()
class MyWidgets:
def __init__(self):
self.colors = [["#292d3e", "#292d3e"], # panel background
# background for current screen tab
["#434758", "#434758"],
["#ffffff", "#ffffff"], # font color for group names
# border line color for current tab
["#bc13fe", "#bc13fe"], # Group down color
# border line color for other tab and odd widgets
["#8d62a9", "#8d62a9"],
["#668bd7", "#668bd7"], # color for the even widgets
["#e1acff", "#e1acff"], # window name
["#000000", "#000000"],
["#AD343E", "#AD343E"],
["#f76e5c", "#f76e5c"],
["#F39C12", "#F39C12"],
["#F7DC6F", "#F7DC6F"],
["#f1ffff", "#f1ffff"],
["#4c566a", "#4c566a"], ]
self.termite = "alacritty"
def init_widgets_list(self):
'''
Function that returns the desired widgets in form of list
'''
widgets_list = [
widget.Sep(
linewidth=0,
padding=5,
foreground=self.colors[2],
background=self.colors[0]
),
widget.GroupBox(
font="Ubuntu Bold",
fontsize=12,
margin_y=2,
margin_x=0,
padding_y=5,
padding_x=3,
borderwidth=3,
active=self.colors[-2],
inactive=self.colors[-1],
# rounded=True,
rounded=False,
# highlight_color=self.colors[9],
# highlight_method="line",
highlight_method='block',
urgent_alert_method='block',
# urgent_border=self.colors[9],
this_current_screen_border=self.colors[9],
this_screen_border=self.colors[4],
other_current_screen_border=self.colors[0],
other_screen_border=self.colors[0],
foreground=self.colors[2],
background=self.colors[0],
disable_drag=True
),
# widget.Prompt(
# prompt=lazy.spawncmd(),
# font="Ubuntu Mono",
# padding=10,
# foreground=self.colors[3],
# background=self.colors[1]
# ),
widget.Sep(
linewidth=0,
padding=25,
foreground=self.colors[2],
background=self.colors[0]
),
widget.WindowName(
foreground=self.colors[6],
background=self.colors[0],
padding=5
),
widget.Systray(
background=self.colors[0],
padding=5
),
# widget.TextBox(
# font="Ubuntu Bold",
# text='',
# background=self.colors[0],
# foreground=self.colors[11],
# padding=0,
# fontsize=37
# ),
widget.Battery(
charge_char='+', discharge_char='-', error_message='error',
format='{percent:2.0%} ({char}{hour:d}:{min:02d})', hide_threshold=None,
low_percentage=0.1, foreground=self.colors[7], background=self.colors[10], update_delay=10),
widget.TextBox(
text=" 🖬",
foreground=self.colors[7],
background=self.colors[11],
padding=0,
fontsize=14
),
widget.Memory(
foreground=self.colors[7],
background=self.colors[11],
mouse_callbacks={'Button1': lambda: qtile.cmd_spawn(
self.termite + ' -e htop')},
padding=5
),
widget.ThermalSensor(
# interface="enp5s0",
# fmt='Net: {down} ↓↑ {up}',
foreground=self.colors[7],
background=self.colors[9],
padding=5
),
# widget.TextBox(
# text='',
# background=self.colors[11],
# foreground=self.colors[10],
# padding=0,
# fontsize=37
# ),
widget.TextBox(
text="",
foreground=self.colors[7],
background=self.colors[10],
padding=0,
mouse_callbacks={
"Button1": lambda: qtile.cmd_spawn("pavucontrol")}
),
widget.Volume(
foreground=self.colors[7],
background=self.colors[10],
padding=5
),
# widget.TextBox(
# text='',
# background=self.colors[10],
# foreground=self.colors[9],
# padding=0,
# fontsize=37
# ),
widget.CurrentLayoutIcon(
custom_icon_paths=[os.path.expanduser(
"~/.config/qtile/icons")],
foreground=self.colors[0],
background=self.colors[9],
padding=0,
scale=0.7
),
widget.CurrentLayout(
foreground=self.colors[7],
background=self.colors[9],
padding=5
),
# widget.TextBox(
# text='',
# foreground=self.colors[8],
# background=self.colors[9],
# padding=0,
# fontsize=37
# ),
widget.Clock(
foreground=self.colors[7],
background=self.colors[8],
mouse_callbacks={
"Button1": lambda qtile: qtile.cmd_spawn(PWA.calendar())},
format="%A %d - %H:%M"
),
widget.Sep(
linewidth=0,
padding=10,
foreground=self.colors[0],
background=self.colors[8]
),
]
return widgets_list
def init_widgets_screen(self):
'''
Function that returns the widgets in a list.
It can be modified so it is useful if you have a multimonitor system
'''
widgets_screen = self.init_widgets_list()
return widgets_screen
def init_widgets_screen2(self):
'''
Function that returns the widgets in a list.
It can be modified so it is useful if you have a multimonitor system
'''
widgets_screen2 = self.init_widgets_screen()
return widgets_screen2
def init_screen(self):
'''
Init the widgets in the screen
'''
return [Screen(top=bar.Bar(widgets=self.init_widgets_screen(), opacity=1.0, size=20)),
Screen(top=bar.Bar(
widgets=self.init_widgets_screen2(), opacity=1.0, size=20))
]
# bar = Bar([
# Sep(
# linewidth = 0,
# padding = 2,
# foreground = onedark_darker["color4"],
# background = onedark_darker["color4"]
# ),
# Image(
# filename = "~/.config/qtile/icons/archlinux_blue.png",
# scale = "False",
# mouse_callbacks = {'Button1': lambda: qtile.cmd_spawn("alacritty")},
# background = onedark_darker["color4"],
# ),
# #widget.Sep(
# # linewidth = 0,
# # padding = 2,
# # foreground = onedark_darker["colorback"],
# # background = onedark_darker["colorback"]
# #),
# right_arrow(onedark_darker["color4"], onedark_darker["colorback"]),
# GroupBox(
# font = "JetBrains Nerd Font Mono Bold",
# fontsize = 12,
# fmt = '{}',
# borderwidth = 2,
# background = onedark_darker["colorback"],
# active = onedark_darker["color6"],
# inactive = onedark_darker["color5"],
# rounded = False,
# #Block_highlight_text_color = onedark_darker["color3"],
# highlight_method = 'line',
# highlight_color = onedark_darker["colorback"], # line block colour
# this_current_screen_border = onedark_darker["color4"],
# this_screen_border = onedark_darker["color7"],
# urgent_alert_method = 'line',
# urgent_border = onedark_darker["color10"],
# urgent_text = onedark_darker["color14"],
# disable_drag = True,
# ),
# right_arrow(onedark_darker["colorback"], onedark_darker["color14"]),
# CurrentLayoutIcon(
# custom_icon_paths = [os.path.expanduser("~/.config/qtile/icons")],
# foreground = onedark_darker["colorback"],
# background = onedark_darker["color14"],
# padding = 0,
# scale = 0.7
# ),
# CurrentLayout(
# foreground = onedark_darker["colorback"],
# background = onedark_darker["color14"],
# padding = 5,
# ),
# right_arrow(onedark_darker["color14"], onedark_darker["color9"]),
# TextBox(
# text = '',
# font = "Font Awesome 6 Free Solid",
# fontsize = 15,
# background = onedark_darker["color9"],
# foreground = onedark_darker["color4"],
# padding = 2
# ),
# WindowCount(
# format = ' {num} ',
# background = onedark_darker["color9"],
# foreground = onedark_darker["color4"],
# show_zero = True,
# ),
# right_arrow(onedark_darker["color9"], onedark_darker["color1"]),
# WindowName(
# foreground = onedark_darker["color5"],
# background = onedark_darker["color1"],
# padding = 5,
# format = '[ {name} ]',
# empty_group_string = '[ ]',
# parse_text = parse_func,
# ),
# #widget.Spacer(),
# Sep(
# linewidth = 0,
# padding = 6,
# foreground = onedark_darker["color1"],
# background = onedark_darker["color1"],
# ),
# left_arrow(onedark_darker["color2"], onedark_darker["color1"]),
# TextBox(
# text = '',
# font = "Font Awesome 6 Free Solid",
# fontsize = 15,
# padding = 2,
# foreground = onedark_darker["colorback"],
# background = onedark_darker["color2"],
# ),
# Net(
# interface = "wlp44s0",
# format = '{down} {up}',
# prefix = 'M',
# foreground = onedark_darker["colorback"],
# background = onedark_darker["color2"],
# padding = 5,
# ),
# left_arrow(onedark_darker["color3"], onedark_darker["color2"]),
# TextBox(
# text = '',
# font = "Font Awesome 6 Free Solid",
# fontsize = 15,
# padding = 2,
# foreground = onedark_darker["colorback"],
# background = onedark_darker["color3"]
# ),
# CPU(
# background = onedark_darker["color3"],
# foreground = onedark_darker["colorback"],
# fmt = 'Cpu: {}',
# #format = '{freq_current}GHz {load_percent}%',
# format = '[ {load_percent} ]%',
# padding = 5,
# ),
# left_arrow(onedark_darker["color4"], onedark_darker["color3"]),
# TextBox(
# text = '',
# font = "Font Awesome 6 Free Solid",
# fontsize = 15,
# padding = 2,
# foreground = onedark_darker["colorback"],
# background = onedark_darker["color4"]
# ),
# ThermalSensor(
# foreground = onedark_darker["colorback"],
# background = onedark_darker["color4"],
# threshold = 90,
# fmt = 'Temp: {}',
# format='[ {temp:.0f}{unit} ]',
# padding = 5,
# ),
# left_arrow(onedark_darker["color5"], onedark_darker["color4"]),
# TextBox(
# text = '',
# font = "Font Awesome 6 Free Solid",
# fontsize = 15,
# padding = 2,
# foreground = onedark_darker["colorback"],
# background = onedark_darker["color5"]
# ),
# Memory(
# foreground = onedark_darker["colorback"],
# background = onedark_darker["color5"],
# #mouse_callbacks = {'Button1': lambda: qtile.cmd_spawn(myTerm + ' -e htop')},
# fmt = 'Mem: {}',
# #format = '{MemUsed: .0f}{mm}/{MemTotal: .0f}{mm}',
# format = '[ {MemUsed:.0f} ]{mm}',
# padding = 5,
# ),
# left_arrow(onedark_darker["color6"], onedark_darker["color5"]),
# TextBox(
# text = '',
# font = "Font Awesome 6 Free Solid",
# fontsize = 15,
# padding = 2,
# foreground = onedark_darker["colorback"],
# background = onedark_darker["color6"]
# ),
# Battery(
# padding = 5,
# background = onedark_darker["color6"],
# foreground = onedark_darker["colorback"],
# charge_char = 'AC',
# discharge_char = '',
# empty_char = 'ﮣ',
# full_char = 'ﭹ',
# fmt = 'Bat: {}',
# format = '{char}[ {percent:2.0%} ]', #{hour:d}:{min:02d} {watt:.2f} W'
# #low_background = none,
# low_forground = '#ff0000',
# update_interval = 60,
# ),
# #battery,
# left_arrow(onedark_darker["color7"], onedark_darker["color6"]),
# TextBox(
# text = '',
# font = "Font Awesome 6 Free Solid",
# fontsize = 15,
# padding = 2,
# foreground = onedark_darker["colorback"],
# background = onedark_darker["color7"]
# ),
# PulseVolume(
# background = onedark_darker["color7"],
# foreground = onedark_darker["colorback"],
# fmt = 'Vol: [ {} ]',
# device = 'default',
# channel = 'Master',
# limit_max_volume = True,
# padding = 5,
# update_interval = 0.1,
# mute_command = 'pactl set-sink-mute @DEFAULT_SINK@ toggle',
# volume_up_command = 'pactl set-sink-volume @DEFAULT_SINK@ +5%',
# volume_down_command = 'pactl set-sink-volume @DEFAULT_SINK@ -5%',
# ),
# #volume,
# #widget.Volume(
# # foreground = onedark_darker[8],
# # background = onedark_darker[0],
# # fmt = 'Vol: {}',
# # padding = 5,
# # mouse_callbacks = {'Button1': lambda: qtile.cmd_spawn(myTerm + ' -e alsamixer')}
# #),
# left_arrow(onedark_darker["color10"], onedark_darker["color7"]),
# TextBox(
# text = '',
# font = "Font Awesome 6 Free Solid",
# fontsize = 15,
# padding = 2,
# foreground = onedark_darker["colorback"],
# background = onedark_darker["color10"]
# ),
# Clock(
# foreground = onedark_darker["colorback"],
# background = onedark_darker["color10"],
# format = "%a %d, %b [ %I:%M ]%P",
# padding = 5,
# ),
# left_arrow(onedark_darker["colorback"], onedark_darker["color10"]),
# Systray(
# background = onedark_darker["colorback"],
# padding = 2
# ),
# #widget.TextBox(
# # text = '',
# # font = "Mononoki Regular Bold",
# # fontsize = 18,
# # padding = 0,
# # background = onedark_darker[0],
# # foreground = onedark_darker[9],
# #),
# ], size=25)