def toggle_calcurse(): home = str(Path.home()) if os.path.exists(home+'/.local/share/calcurse/.calcurse.pid') or\ os.path.exists(home+'/.calcurse/.calcurse.pid'): os.system('killall calcurse') # os.remove(home+"...") else: qtile.cmd_spawn(terminal + ' -e calcurse')
def spawn_or_focus(qtile: Qtile, app: str) -> None: """Check if the app being launched is already running, if so focus it""" window = None for win in qtile.windows_map.values(): if isinstance(win, Window): wm_class: list | None = win.get_wm_class() if wm_class is None or win.group is None: return if any(item.lower() in app for item in wm_class): window = win group = win.group group.cmd_toscreen(toggle=False) break if window is None: qtile.cmd_spawn(app) elif window == qtile.current_window: try: assert ( qtile.current_layout.cmd_swap_main is not None ), "The current layout should have cmd_swap_main" qtile.current_layout.cmd_swap_main() except AttributeError: return else: qtile.current_group.focus(window)
def __inner(qtile): if qtile.groups_map[group].windows: # TODO debug qtile.groups_map[group].cmd_toscreen() else: qtile.groups_map[group].cmd_toscreen() qtile.cmd_spawn(app)
def f(qtile): if qtile.groups_map[group].windows: qtile.groups_map[group].cmd_toscreen(toggle=False) qtile.cmd_spawn(app) else: qtile.groups_map[group].cmd_toscreen(toggle=False) qtile.cmd_spawn(app)
def f(qtile): if qtile.widgetMap['clementine'].is_playing(): qtile.cmd_spawn("clementine --%s" % state) if qtile.widgetMap['spotify'].is_playing: cmd = "Next" if state == "next" else "Previous" qtile.cmd_spawn( "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.%s" % cmd)
def get_widgets(): return [ widget.CurrentLayoutIcon( custom_icon_paths=[os.path.expanduser("~/.config/qtile/icons")], scale=0.8, ), widget.GroupBox(), widget.WindowName(), widget.TextBox(" | ", name="separator"), widget.Clipboard(max_width=50, timeout=None), widget.TextBox(" | ", name="separator"), widget.TextBox("CPU", name="cpu_label"), widget.CPUGraph(**graph_args), widget.TextBox("Mem", name="memory_label"), ColoredMemoryGraph(**graph_args), widget.TextBox("Net", name="net_label"), widget.NetGraph(**graph_args), widget.TextBox(" | ", name="separator"), widget.DF( mouse_callbacks={'Button1': lambda: qtile.cmd_spawn('qdirstat')}, format='{uf}/{s}{m} free on {p}', visible_on_warn=False), # TODO figure out why this doesn't work # widget.HDDBusyGraph(**graph_args), widget.TextBox(" | ", name="separator"), widget.Image(filename='~/.config/qtile/icons/volume-icon.png', margin_y=4), widget.Volume(fmt='{}'), widget.TextBox(" | ", name="separator"), widget.Image(filename='~/.config/qtile/icons/battery-icon.png'), widget.Battery( format='{percent:2.0%} {char}{watt:.1f}W', charge_char='+', discharge_char='-', update_interval=15, # seconds ), widget.TextBox(" | ", name="separator"), widget.Image(filename='~/.config/qtile/icons/brightness-icon.png', margin_x=1, margin_y=4.5), widget.Backlight(format='{percent: 2.0%}', backlight_name='intel_backlight'), widget.TextBox(" | ", name="separator"), # Requires # sudo apt install libiw-dev # pip install iwlib widget.Wlan(interface='wlp2s0', format=' {essid} {quality}%', mouse_callbacks={ 'Button1': lambda: qtile.cmd_spawn('cinnamon-settings network') }), widget.TextBox(" | ", name="separator"), widget.Systray(), widget.Clock(format='%Y-%m-%d %a %I:%M %p'), ]
def open_menu(qtile): # logger.warning(f'sas {qtile.layout}') for screen in qtile.screens: logger.warning(f'as {screen.group.layout}') logger.warning(f'sas {screen}') # qtile.cmd_spawn("notify-qtile-update") # for c in screen.group.layout: # logger.warning(f'lala {c}') if not screen.group.windows: qtile.cmd_spawn("xmenu.sh")
def playpause(qtile): global last_playing if qtile.widgetMap['clementine'].is_playing( ) or last_playing == 'clementine': qtile.cmd_spawn("clementine --play-pause") last_playing = 'clementine' if qtile.widgetMap['spotify'].is_playing or last_playing == 'spotify': qtile.cmd_spawn( "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause" ) last_playing = 'spotify'
def click(x, y, button): action_list = ["systemctl reboot", "systemctl poweroff"] try: if button == 1: x_pos = int(x/popup.width*len(action_list)) #log_test("clicked on: " + action_list[x_pos]) qtile.cmd_spawn(action_list[x_pos]) else: popup.hide() popup.kill() except Exception as e: log_test(f"click error: {e}")
def keyboard_layout(bg=theme.background, fg=theme.foreground): return widget.KeyboardLayout( foreground=fg, background=bg, configured_keyboards=user.languages, font=theme.font_bold, mouse_callbacks={ # This doesn't work # "Button1": lambda: lazy.widget["keyboardlayout"].next_keyboard(), "Button1": lambda: qtile.cmd_spawn("setxkbmap us"), "Button3": lambda: qtile.cmd_spawn("setxkbmap ru"), }, )
def start_widget(): return widget.Image( filename=theme.distributor_logo, mouse_callbacks={ "Button1": lambda: qtile.cmd_spawn(apps.myLauncher), }, )
def get_cpu(): return widget.CPU( format="{freq_current}GHz {load_percent}%", mouse_callbacks={ "Button1": lambda: qtile.cmd_spawn(terminal + " -e bashtop") }, )
def get_netstats(): return widget.Net( format="{down} " + fa.icons["arrow-circle-down"] + fa.icons["arrow-circle-up"] + " {up}", update_interval=2, mouse_callbacks={"Button1": lambda: qtile.cmd_spawn("rofi-wifi-menu")}, )
def profile(): return widget.Image( filename=theme.user_icon, mouse_callbacks={ "Button1": lambda: qtile.cmd_spawn(dm + "dm-power"), }, )
def get_app_btn(text, color, cmd): return widget.TextBox( text=text, font=fonts.ICON, foreground=color, fontshadow=colors.black[4], mouse_callbacks={'Button1': lambda: qtile.cmd_spawn(cmd)})
def get_clock(): return widget.Clock( format="%d %b " + fa.icons["calendar-alt"] + " %H:%M" + " " + fa.icons["hourglass"], update_interval=15, mouse_callbacks={"Button1": lambda: qtile.cmd_spawn("korganizer")}, )
def init_widgets_list1(): widgets_list = left_widgets() + [ widget.TaskList(background=colors[0], border=colors[0]), widget.Net(interface="enp0s3", fmt="{:>20}", format='{down} ↓↑ {up}', foreground=colors[2], background=colors[0], mouse_callbacks={ 'Button1': lambda qtile: qtile.cmd_spawn("stacer") }, padding=0), sep_widget, widget.CPU(background=colors[0], max_chars=15), sep_widget, widget.Memory(foreground=colors[2], background=colors[0], mouse_callbacks={ 'Button1': lambda: qtile.cmd_spawn('kitty -e htop') }, padding=5), sep_widget, widget.TextBox(text=" Vol:", foreground=colors[2], background=colors[0], padding=0), widget.Volume(foreground=colors[2], background=colors[0], padding=5), sep_widget, widget.CurrentLayoutIcon( custom_icon_paths=[os.path.expanduser("~/.config/qtile/icons")], foreground=colors[0], background=colors[0], padding=0, scale=-1.7), widget.CurrentLayout( foreground=colors[2], background=colors[0], padding=2), sep_widget, widget_clock, widget.Sep(linewidth=0, padding=10, foreground=colors[0], background=colors[0]), widget.Systray(background=colors[0], padding=0), ] return widgets_list
def get_diskinfo(): return widget.DF( format=fa.icons["save"] + " {r:.0f}% full [{uf}{m} left]", warn_space=50, visible_on_warn=False, warn_color=colors["red"], measure="G", mouse_callbacks={"Button1": lambda: qtile.cmd_spawn("dolphin")}, )
def make_volume_widget(widget_foreground, firstcolour, powerline: bool): foreground = "#61afef" background = BACKGROUND return widget.Volume( foreground=foreground, background=background, fmt="{}", # right click launches pavucontrol mouse_callbacks={"Button3": lambda: qtile.cmd_spawn("pavucontrol")}, )
def make_cpu_widget(widget_foreground, firstcolour, powerline: bool): foreground = "#e06c75" background = BACKGROUND return widget.CPU( foreground=foreground, background=background, format=" {load_percent}%", mouse_callbacks={ "Button1": lambda: qtile.cmd_spawn(f"{TERM} -e htop") }, )
def in_wid_list_sec(): wid_list_sec = [ widget.TextBox( font='Font Awesome 5 Free', fontsize=15, foreground=colors[7], text="", mouse_callbacks={'Button1': lambda: qtile.cmd_spawn('urxvt')}, fontshadow=colors[3]), ] return wid_list_sec
def make_ram_widget(widget_foreground, secondcolour, powerline: bool): foreground = "#98c379" background = BACKGROUND return widget.Memory( foreground=foreground, background=background, format=" {MemUsed:.0f}M", mouse_callbacks={ "Button1": lambda: qtile.cmd_spawn(f"{TERM} -e htop") }, )
def get_widgets(start_range=None, end_range=None): widgets_list = [ put_separator(), put_image('~/.config/qtile/python.png', 'Button1', qtile.cmd_spawn, 'alacritty -e code /home/nazgo/.config/qtile'), put_separator(), put_group_layout(), widget.Prompt(), put_current_window_name(), widget.Systray(background='ffdab9'), put_text_box('volume: ', 'Button1', qtile.cmd_spawn, 'alacritty -e alsamixer'), widget.Volume(foreground=main_color, mouse_callbacks={ 'Button1': lambda: qtile.cmd_spawn('alacritty -e alsamixer') }), put_text_box('clock: '), put_clock(), put_text_box('kb: '), put_keyboard_indicator(), put_text_box('[]=:'), put_current_layout(), put_image('~/.config/qtile/pacman.png', 'Button1', qtile.cmd_spawn, 'alacritty -e sudo pacman -Syyu'), widget.CheckUpdates( distro='Arch', display_format='{updates}', colour_have_updates=main_color, mouse_callbacks={ 'Button1': lambda: qtile.cmd_spawn('alacritty -e sudo pacman -Syyu') }), put_separator(), ] if start_range is not None and end_range is not None: return widgets_list[start_range:end_range] return widgets_list
def get_updates(): # not showing correctly in bar return widget.CheckUpdates( update_interval=1800, distro="Arch_checkupdates", format="{updates} " + fa.icons["cubes"], foreground=colors["white"], colour_have_updates=colors["green"], colour_no_updates=colors["foreground"], mouse_callbacks={ "Button1": lambda: qtile.cmd_spawn(terminal + " -e sudo paru") }, )
def updater(bg=theme.background, fg=theme.foreground): return [ widget.TextBox( text="", font=theme.font_awesome, fontsize=theme.icon_size - 3, padding_x=2, foreground=fg, background=bg, mouse_callbacks={ "Button1": lambda: qtile.cmd_spawn(apps.myTerminal + " -e sudo pacman -Syu"), }, ), widget.CheckUpdates( distro="Arch_checkupdates", display_format="{updates}", no_update_string="n/a", update_interval="1800", font=theme.font_bold, colour_have_updates=fg, colour_no_updates=fg, background=bg, ), widget.CheckUpdates( distro="Arch", custom_command="pacman -Qu | grep -e nvidia -e linux", update_interval="1800", display_format="", font=theme.font_awesome, fontsize=theme.icon_size - 3, colour_have_updates=theme.alert, # colour_no_updates=theme.foreground, background=bg, ), widget.CheckUpdates( distro="Arch", custom_command="pacman -Qu | grep -e nvidia -e linux", update_interval="1800", display_format="{updates}", font=theme.font_bold, colour_have_updates=theme.alert, colour_no_updates=fg, background=bg, ), ]
def volume(bg=theme.background, fg=theme.foreground): return [ widget.TextBox( text="", font=theme.font_awesome, fontsize=theme.icon_size, padding_x=2, foreground=fg, background=bg, ), widget.Volume( font=theme.font_bold, foreground=fg, background=bg, step=user.volume_step, mouse_callbacks={ "Button3": lambda: qtile.cmd_spawn(apps.myAudioManager), }, ), ]
def init_widgets_list_secondary(): widgets_list = [ widget.Spacer(length=2, background=colors[0]), # Left Side of the bar widget.GroupBox( font="Iosevka Nerd Font", fontsize=25, foreground=colors[2], background=colors[0], borderwidth=15, highlight_method="text", this_current_screen_border=colors[5], active=colors[3], inactive=colors[4], ), widget.Sep(linewidth=3, margin=5, background=colors[0]), tasklist2, widget.TextBox( font="Iosevka Nerd Font", fontsize=25, text=" ", foreground=colors[5], background=colors[0], ), widget.CurrentLayout(foreground=colors[2], background=colors[0]), widget.Spacer(length=bar.STRETCH, background=colors[0]), widget.TextBox( font="Iosevka Nerd Font", fontsize=25, text="⏻ ", foreground=colors[5], background=colors[0], mouse_callbacks={ "Button1": lambda: qtile.cmd_spawn("shutdown -h now") }, ), widget.Spacer(length=10, background=colors[0]) # Right side of Bar ] return widgets_list
def init_widgets_list(): widgets_list = [ widget.Sep(linewidth=0, padding=6, foreground=colors['color7'], background=colors['color0']), widget.GroupBox(font="Cantarell Bold", fontsize=10, margin_y=3, margin_x=0, padding_y=5, padding_x=3, borderwidth=3, active=colors['color5'], inactive=colors['color7'], rounded=False, highlight_color=colors['color0'], highlight_method="line", this_current_screen_border=colors['color5'], this_screen_border=colors['color5'], foreground=colors['color7'], background=colors['color0']), widget.Sep( linewidth=0, padding=30, foreground=colors['color7'], ), widget.WindowName(foreground=colors['color4'], font='Inconsolata Bold', fontsize='15', padding=2), widget.Systray(padding=5, margin=5, fontsize=12), widget.Sep( linewidth=0, padding=6, ), widget.TextBox(text="🌡️", padding=2, fontsize=12), widget.ThermalSensor(threshold=90, padding=5), widget.Sep(linewidth=0, padding=5), widget.TextBox(text="🧠", padding=0, fontsize=14), widget.CPU(format='{freq_current}GHz {load_percent}%', padding=5), widget.Sep( linewidth=0, padding=6, ), widget.TextBox(text="💽", padding=0, fontsize=14), widget.Memory(mouse_callbacks={ 'Button1': lambda: qtile.cmd_spawn(myTerm + ' -e htop') }, format='{MemUsed: .0f}{mm}/{MemTotal: .0f}{mm}', measure_mem='M', padding=5), widget.Sep( linewidth=0, padding=6, ), widget.TextBox(text="🔉", padding=0), widget.PulseVolume(padding=5, mouse_callbacks={ 'Button1': lambda: qtile.cmd_spawn('pavucontrol') }), widget.Sep( linewidth=0, padding=6, ), widget.CurrentLayoutIcon( custom_icon_paths=[os.path.expanduser("~/.config/qtile/icons")], padding=0, scale=0.7), widget.CurrentLayout(padding=5), widget.Sep( linewidth=0, padding=6, ), widget.Clock(format="📅 %A, %B %d 🕒 %H:%M "), ] return widgets_list
def init_widgets_list(self): ''' Function that returns the desired widgets in form of list ''' widgets_list = [ widget.Sep(linewidth=0, padding=6, foreground=self.colors[2], background=self.colors[0]), widget.CurrentLayoutIcon(custom_icon_paths=[ os.path.expanduser("~/.config/qtile/icons") ], background=self.colors[0], padding=0, scale=0.75), widget.Sep(linewidth=0, padding=5, foreground=self.colors[2], background=self.colors[0]), widget.GroupBox(font="JetBrains Mono", fontsize=12, margin_y=3, margin_x=0, padding_y=5, padding_x=3, borderwidth=3, active=self.colors[2], inactive=self.colors[1], rounded=False, 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=False), widget.Sep(linewidth=0, padding=5, foreground=self.colors[2], background=self.colors[0]), widget.WindowTabs( foreground=self.colors[6], background=self.colors[0], padding=0, ), widget.TextBox(text='', foreground=self.colors[14], background=self.colors[0], padding=0, fontsize=37), widget.TextBox(text=" ", foreground=self.colors[7], background=self.colors[14], padding=0, fontsize=14), widget.TextBox(text=self.host, foreground=self.colors[7], background=self.colors[14], padding=5, fontsize=13), widget.TextBox(text='', foreground=self.colors[11], background=self.colors[14], padding=0, fontsize=37), widget.TextBox(text=" ", foreground=self.colors[7], background=self.colors[11], padding=0, fontsize=14), widget.KeyboardLayout( foreground=self.colors[7], background=self.colors[11], ), widget.TextBox(text='', background=self.colors[11], foreground=self.colors[10], padding=0, fontsize=37), widget.TextBox( text=" ", background=self.colors[10], padding=0, fontsize=14, mouse_callbacks={ 'Button1': lambda: qtile.cmd_spawn(self.kitty + ' -e sudo pacman -Syu' ) }, ), widget.CheckUpdates( update_interval=1000, mouse_callbacks={ 'Button1': lambda: qtile.cmd_spawn(self.kitty + ' -e sudo pacman -Syu' ) }, background=self.colors[10], display_format='{updates}', # colour_have_updates=self.colors[0], distro="Arch_checkupdates", ), widget.TextBox(text='', foreground=self.colors[1], background=self.colors[10], padding=0, fontsize=37), widget.TextBox(text=" ", foreground=self.colors[7], background=self.colors[1], padding=0, fontsize=18), widget.Clock(background=self.colors[1], format="%A, %B %d - %H:%M "), widget.TextBox(text='', foreground=self.colors[0], background=self.colors[1], padding=0, fontsize=37), widget.TextBox( text=" ", background=self.colors[0], padding=0, ), widget.Volume(background=self.colors[0], padding=5), widget.Battery( background=self.colors[0], padding=5, update_interval=2, format='{char} {percent:2.0%} {hour:d}:{min:02d}', charge_char='CHR', discharge_char='DIS', empty_char='EMP', full_char='FUL', unknown_char='UNK', ), widget.Systray(background=self.colors[0], padding=5), ] return widgets_list
def init_widgets_list(): prompt = "{0}@{1}: ".format(os.environ["USER"], socket.gethostname()) widgets_list = [ widget.Sep(linewidth=1, padding=10, foreground=colors[15], background=colors[15]), # widget.Image( filename="~/.config/qtile/icons/garuda-red.png", iconsize=9, background=colors[15], mouse_callbacks={'Button1': lambda: qtile.cmd_spawn('jgmenu_run')}), widget.GroupBox(**base(bg=colors[15]), font='UbuntuMono Nerd Font', fontsize=11, margin_y=3, margin_x=2, padding_y=5, padding_x=4, borderwidth=3, active=colors[5], inactive=colors[6], rounded=True, highlight_method='block', urgent_alert_method='block', urgent_border=colors[16], this_current_screen_border=colors[20], this_screen_border=colors[17], other_current_screen_border=colors[13], other_screen_border=colors[17], disable_drag=True), widget.TaskList( highlight_method='border', # or block icon_size=17, max_title_width=150, rounded=True, padding_x=0, padding_y=0, margin_y=0, fontsize=14, border=colors[7], foreground=colors[9], margin=2, txt_floating='🗗', txt_minimized='>_ ', borderwidth=1, background=colors[20], #unfocused_border = 'border' ), widget.CurrentLayoutIcon( custom_icon_paths=[os.path.expanduser("~/.config/qtile/icons")], foreground=colors[5], background=colors[3], padding=0, scale=0.7), widget.CurrentLayout(font="Noto Sans Bold", fontsize=12, foreground=colors[5], background=colors[3]), widget.Net( font="Noto Sans", fontsize=12, # Here enter your network name interface=["wlp6s0"], format='{down} ↓↑ {up}', foreground=colors[5], background=colors[19], padding=0, ), widget.CPU( font="Noto Sans", #format = '{MemUsed}M/{MemTotal}M', update_interval=1, fontsize=12, foreground=colors[5], background=colors[22], mouse_callbacks={ 'Button1': lambda: qtile.cmd_spawn(myTerm + ' -e htop') }, ), widget.Memory( font="Noto Sans", format='{MemUsed: .0f}M/{MemTotal: .0f}M', update_interval=1, fontsize=12, measure_mem='M', foreground=colors[5], background=colors[16], mouse_callbacks={ 'Button1': lambda: qtile.cmd_spawn(myTerm + ' -e htop') }, ), widget.Clock(foreground=colors[9], background=colors[23], fontsize=12, format="%Y-%m-%d %H:%M"), widget.Systray(background=colors[10], icon_size=20, padding=4), ] return widgets_list