From 619635a632f7d6061f94f43bcf83ca52eae45db9 Mon Sep 17 00:00:00 2001 From: purhan Date: Thu, 18 Feb 2021 10:59:53 +0530 Subject: [PATCH] add qtile --- src/.config/awesome/rc.lua | 19 ++ .../qtile/__pycache__/config.cpython-38.pyc | Bin 0 -> 5777 bytes src/.config/qtile/autostart.sh | 5 + src/.config/qtile/config.py | 289 ++++++++++++++++++ src/.config/qtile/requirements.txt | 3 + src/.config/qtile/src/rofi-power.sh | 35 +++ 6 files changed, 351 insertions(+) create mode 100644 src/.config/qtile/__pycache__/config.cpython-38.pyc create mode 100755 src/.config/qtile/autostart.sh create mode 100644 src/.config/qtile/config.py create mode 100644 src/.config/qtile/requirements.txt create mode 100755 src/.config/qtile/src/rofi-power.sh diff --git a/src/.config/awesome/rc.lua b/src/.config/awesome/rc.lua index 5f333e8..d8fa1b8 100644 --- a/src/.config/awesome/rc.lua +++ b/src/.config/awesome/rc.lua @@ -35,6 +35,25 @@ _G.client.connect_signal('manage', function(c) end end) +-- Move cursor to focused window +function move_mouse_onto_focused_client() + local c = client.focus + gears.timer( { timeout = 0.1, + autostart = true, + single_shot = true, + callback = function() + if mouse.object_under_pointer() ~= c then + local geometry = c:geometry() + local x = geometry.x + geometry.width/2 + local y = geometry.y + geometry.height/2 + mouse.coords({x = x, y = y}, true) + end + end } ) +end + +client.connect_signal("focus", move_mouse_onto_focused_client) +client.connect_signal("swapped", move_mouse_onto_focused_client) + -- Enable sloppy focus, so that focus follows mouse. _G.client.connect_signal('mouse::enter', function(c) c:emit_signal('request::activate', 'mouse_enter', {raise = true}) diff --git a/src/.config/qtile/__pycache__/config.cpython-38.pyc b/src/.config/qtile/__pycache__/config.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..598658346991a7cbed99d31c70a96bcf431b616e GIT binary patch literal 5777 zcmWIL<>g{vU|`tjresOdt6 z6kC`mI5Z%t%@#7G*rA9+)SEA4NU?{BLsNo9ii0G>0?QOfBzHNb3T0VkS*JLsxb%X3 z1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WTE55~&l9^m`iyzXNiBCyQODxSPDZa&$ zoL^9RODMIXBsH%%Gd~X@!|aq;bc+Mrzj4a1xWyJwl%HEra*HjvATc?$=oWi$WpPPS zVkM|Q1SUx)i?cz!u3PL7{}$g8Elw?oFUT*>1l4r#Qsx#sZ;p%ie~6~||%R>mh~=B1<--4cX}B^DGwD`^%`+PEc@mYaUrqU#F#`FB^V_b#lVn>k%f_okq@MwU4Rh;g&2jHKyt`>klA3JJ6XKB7~$|2 z3nw2l$Q&jnCWvboK{OL1(@&QFO#hhvvj~bYsWC}0sWC&v8JT{wadNS7v9mEU{byof zW5fwRGW}!w#G(S#_m_>8gPDnug$ZmM%ognQdlq4csa%X~j35l+@i1~dVp3qb&!mjg zjIS*JnfRGLFx_GK&td}!9}Y$iaQLz?Ffnj2aQtUs7W&4*3yvQ|oG`O7a`6BF(Pb?} literal 0 HcmV?d00001 diff --git a/src/.config/qtile/autostart.sh b/src/.config/qtile/autostart.sh new file mode 100755 index 0000000..db6b643 --- /dev/null +++ b/src/.config/qtile/autostart.sh @@ -0,0 +1,5 @@ +#!/bin/bash +compton & +nitrogen --restore & +nm-applet & + diff --git a/src/.config/qtile/config.py b/src/.config/qtile/config.py new file mode 100644 index 0000000..37ffaa6 --- /dev/null +++ b/src/.config/qtile/config.py @@ -0,0 +1,289 @@ +import os +import subprocess + +from typing import List + +from libqtile import bar, layout, widget, hook +from libqtile.config import Click, Drag, Group, Key, Screen, ScratchPad, DropDown +from libqtile.lazy import lazy +from libqtile.utils import guess_terminal + +mod = "mod4" +terminal = "kitty" +rofi = """ +env /usr/bin/rofi -show drun -display-drun -run-command +"/bin/bash -c -i 'shopt -s expand_aliases; {cmd}'" +""" +config_directory = os.path.expanduser("~/.config/qtile") + +BLACK = "#212121" +LIGHT_GREY = "#3c3c3c" +GREY = "#333333" +DARK_GREY = "#1a1a1a" +YELLOW = "#e1be7f" +GREEN = "#92c96a" +BLUE = "#66aeea" +RED = "#f35a5a" +CYAN = "#4083bc" +MAGENTA = "#c57cda" +ORANGE = "#cd996a" +WHITE = "#d6d6d6" + +keys = [ + # Switch between windows in current stack pane + Key([mod], "k", lazy.layout.down(), desc="Move focus down in stack pane"), + Key([mod], "j", lazy.layout.up(), desc="Move focus up in stack pane"), + # Move windows up or down in current stack + Key( + [mod, "control"], + "k", + lazy.layout.shuffle_down(), + desc="Move window down in current stack ", + ), + Key( + [mod, "control"], + "j", + lazy.layout.shuffle_up(), + desc="Move window up in current stack ", + ), + Key(["mod1"], "Tab", lazy.layout.next(), desc="Move focus to next window in group"), + Key( + ["mod1", "shift"], + "Tab", + lazy.layout.previous(), + desc="Move focus to previous window in group", + ), + # 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, "shift"], + "Return", + 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, "shift"], "q", lazy.window.kill(), desc="Kill focused window"), + Key([mod, "shift"], "c", lazy.window.kill(), desc="Kill focused window"), + Key([mod, "control"], "r", lazy.restart(), desc="Restart qtile"), + Key([mod, "control"], "q", lazy.shutdown(), desc="Shutdown qtile"), + Key([mod], "r", lazy.spawn(rofi), desc="Launch Rofi"), + Key( + [mod], + "p", + lazy.spawn(f"{config_directory}/src/rofi-power.sh"), + desc="Launch rofi power options", + ), + # Volume Control + Key([], "XF86AudioRaiseVolume", lazy.spawn("amixer -c 0 -q set Master 2dB+")), + Key([], "XF86AudioLowerVolume", lazy.spawn("amixer -c 0 -q set Master 2dB-")), + Key([], "XF86AudioMute", lazy.spawn("amixer -D pulse set Master 1+ toggle")), + Key([mod], "equal", lazy.spawn("amixer -c 0 -q set Master 2dB+")), + Key([mod], "minus", lazy.spawn("amixer -c 0 -q set Master 2dB-")), + # Window management + Key([mod], "h", lazy.layout.shrink_main(), desc="Expand master (MonadTall)"), + Key([mod], "l", lazy.layout.grow_main(), desc="Shrink master (MonadTall)"), + Key( + [mod, "shift"], + "h", + lazy.layout.swap_left(), + desc="Move window to left (MonadTall)", + ), + Key( + [mod, "shift"], + "l", + lazy.layout.swap_right(), + desc="Moce window to right (MonadTall)", + ), + Key([mod], "k", lazy.group["scratchpad"].dropdown_toggle("dropdown_terminal")), + Key([mod], "Left", lazy.screen.prev_group(skip_managed=True)), + Key([mod], "Right", lazy.screen.next_group(skip_managed=True)), +] + +group_names = ( + ("web", {"layout": "max"}), + ("dev", {"layout": "monadtall"}), + ("term", {"layout": "monadtall"}), + ("file", {"layout": "monadtall"}), + ("chat", {"layout": "monadtall"}), + ("misc", {"layout": "monadtall"}), +) + +groups = [Group(name, **kwargs) for name, kwargs in group_names] + +# Create a dropdown terminal +groups.append( + ScratchPad( + "scratchpad", + [ + DropDown( + "dropdown_terminal", + f"{terminal} -T dropdown_terminal", + on_focus_lost_hide=False, + opacity=1, + width=0.999, + x=0.0005, + height=0.55, + ), + ], + ), +) + +for i, (name, kwargs) in enumerate(group_names, 1): + # Switch to another group + keys.append(Key([mod], str(i), lazy.group[name].toscreen(toggle=False))) + # Switch to last group + keys.append(Key([mod], "Escape", lazy.screen.toggle_group())) + # Send window to group + keys.append(Key([mod, "shift"], str(i), lazy.window.togroup(name))) + +layout_theme = { + "border_width": 2, + "margin": 0, + "single_border_width": 0, + "border_focus": GREEN, + "border_normal": BLACK, +} + +layouts = [ + layout.Max(**layout_theme), + # layout.Stack(**layout_theme, num_stacks=2), + # Try more layouts by unleashing below layouts. + # layout.Bsp(**layout_theme), + # layout.Columns(**layout_theme), + # layout.Matrix(**layout_theme), + layout.MonadTall(**layout_theme), + # layout.MonadWide(**layout_theme), + # layout.RatioTile(**layout_theme), + # layout.Tile(**layout_theme), + # layout.TreeTab(**layout_theme), + # layout.VerticalTile(**layout_theme), + # layout.Zoomy(**layout_theme), + layout.Floating( + **layout_theme, + float_rules=[ + # Run the utility of `xprop` to see the wm class and name of an X client. + {"wmclass": "confirm"}, + {"wmclass": "dialog"}, + {"wmclass": "download"}, + {"wmclass": "error"}, + {"wmclass": "file_progress"}, + {"wmclass": "notification"}, + {"wmclass": "splash"}, + {"wmclass": "toolbar"}, + {"wmclass": "confirmreset"}, # gitk + {"wmclass": "makebranch"}, # gitk + {"wmclass": "maketag"}, # gitk + {"wname": "branchdialog"}, # gitk + {"wname": "pinentry"}, # GPG key password entry + {"wmclass": "ssh-askpass"}, # ssh-askpass + ], + ), +] + +widget_defaults = dict( + font="Ubuntu", + fontsize=12, + padding=3, +) +extension_defaults = widget_defaults.copy() + +screens = [ + Screen( + top=bar.Bar( + [ + widget.GroupBox( + margin_y=3, + margin_x=0, + padding_y=5, + padding_x=3, + disable_drag=True, + active=BLUE, + inactive=WHITE, + rounded=False, + highlight_color=BLUE, + highlight_method="block", + this_current_screen_border=BLUE, + this_screen_border=GREEN, + block_highlight_text_color=BLACK, + other_current_screen_border=GREEN, + other_screen_border=BLACK, + urgent_alert_method="text", + urgent_text=RED, + ), + widget.Prompt(), + widget.Spacer(), + widget.Systray(), + widget.Clock(format="%m/%d %a %I:%M"), + widget.Sep(), + widget.CPU(format="﬙ {load_percent}%"), + widget.Sep(), + widget.Memory(), + widget.Volume(), + widget.Battery(format="{char} {percent:2.0%}", notify_below=20), + widget.CurrentLayoutIcon(scale=0.65), + ], + 20, + ), + bottom=bar.Bar( + [ + widget.TaskList( + borderwidth=0, + spacing=0, + highlight_method="block", + background=GREY, + border=BLACK, + markup_floating="{}", + markup_minimized="{}", + icon_size=0, + margin=0, + rounded=False, + title_width_method="uniform", + ), + ], + 18, + ), + ), +] + +# 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.toggle_floating()), +] + +dgroups_key_binder = None +dgroups_app_rules = [] # type: List +main = None # WARNING: this is deprecated and will be removed soon +follow_mouse_focus = True +bring_front_click = False +cursor_warp = False +auto_fullscreen = True +focus_on_window_activation = "smart" + + +@hook.subscribe.startup +def autostart(): + subprocess.call([f"{config_directory}/autostart.sh"]) + + +# 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" diff --git a/src/.config/qtile/requirements.txt b/src/.config/qtile/requirements.txt new file mode 100644 index 0000000..5c92057 --- /dev/null +++ b/src/.config/qtile/requirements.txt @@ -0,0 +1,3 @@ +qtile==0.16.2.dev209+gd5848931 +psutil==5.8.0 + diff --git a/src/.config/qtile/src/rofi-power.sh b/src/.config/qtile/src/rofi-power.sh new file mode 100755 index 0000000..b626d30 --- /dev/null +++ b/src/.config/qtile/src/rofi-power.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +# rofi-power +# Use rofi to call systemctl for shutdown, reboot, etc + +# 2016 Oliver Kraitschy - http://okraits.de + +OPTIONS="Poweroff\nExit\nReboot\nSuspend\nHibernate" + +config_path=$(dirname "$0") + +LAUNCHER="rofi -dmenu -i" +USE_LOCKER="false" +LOCKER="i3lock-fancy" + +option=`echo -e $OPTIONS | $LAUNCHER | awk '{print $1}' | tr -d '\r\n'` +case $option in + Exit) + kill -9 -1 + ;; + Reboot) + systemctl reboot + ;; + Poweroff) + systemctl poweroff + ;; + Suspend) + $($USE_LOCKER) && "$LOCKER"; systemctl suspend + ;; + Hibernate) + $($USE_LOCKER) && "$LOCKER"; systemctl hibernate + ;; + *) + ;; +esac